Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create table SomeTable
- (
- id uniqueidentifier default newsequentialid(),
- foo text
- )
- insert into SomeTable (foo)
- output inserted.id
- values ('bar')
- using (var conn = new SqlConnection(@"..."))
- using (var cmd = conn.CreateCommand())
- {
- cmd.CommandText = "insert into SomeTable (foo) output inserted.id values ('bar')";
- conn.Open();
- var guid = (Guid)cmd.ExecuteScalar();
- Console.WriteLine(guid);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement