Click here to Skip to main content
15,843,623 members
Home / Discussions / Database
   

Database

 
AnswerRe: About length param of Binary Pin
Mike Dimmick29-Nov-07 8:55
Mike Dimmick29-Nov-07 8:55 
Question[Message Deleted] Pin
gubba29-Nov-07 0:31
gubba29-Nov-07 0:31 
AnswerRe: retreiving rows Pin
Christian Graus29-Nov-07 0:43
protectorChristian Graus29-Nov-07 0:43 
General[Message Deleted] Pin
gubba29-Nov-07 0:51
gubba29-Nov-07 0:51 
GeneralRe: retreiving rows Pin
Pete O'Hanlon29-Nov-07 0:55
subeditorPete O'Hanlon29-Nov-07 0:55 
AnswerRe: retreiving rows Pin
Pete O'Hanlon29-Nov-07 0:54
subeditorPete O'Hanlon29-Nov-07 0:54 
AnswerRe: retreiving rows Pin
Paddy Boyd29-Nov-07 2:52
Paddy Boyd29-Nov-07 2:52 
QuestionObtaining value of identity field when inserting into SQL Pin
Dewald28-Nov-07 23:49
Dewald28-Nov-07 23:49 
Hi all,

I've been trying to find a similar question but couldn't find one so forgive me if this has already been dealt with.

Is there a way that I can immediately obtain the value of an auto incrementing identity field in SQL if I insert a new record?

Let's say I run the following command:
SqlCommand myCommand = new SqlCommand("INSERT INTO Users (UserName, Age) VALUES ('Joe Bloggs', 30)", myConnection);
but the Users table has an auto incrementing identity field called UserID. Is there a way I can obtain the new value of UserID without having to run a subsequent SELECT UserID FROM Users WHERE... query?

Thanks
AnswerRe: Obtaining value of identity field when inserting into SQL Pin
Colin Angus Mackay29-Nov-07 0:07
Colin Angus Mackay29-Nov-07 0:07 
GeneralRe: Obtaining value of identity field when inserting into SQL Pin
Tobias Schoenig29-Nov-07 0:31
Tobias Schoenig29-Nov-07 0:31 
GeneralRe: Obtaining value of identity field when inserting into SQL Pin
Colin Angus Mackay29-Nov-07 0:40
Colin Angus Mackay29-Nov-07 0:40 
GeneralRe: Obtaining value of identity field when inserting into SQL Pin
Dewald29-Nov-07 1:16
Dewald29-Nov-07 1:16 
QuestionRank(sql) Pin
r a j u u28-Nov-07 23:44
r a j u u28-Nov-07 23:44 
AnswerRe: Rank(sql) Pin
pmarfleet29-Nov-07 1:07
pmarfleet29-Nov-07 1:07 
Question[Message Deleted] Pin
gubba28-Nov-07 23:42
gubba28-Nov-07 23:42 
AnswerRe: Regarding retreiving values from table Pin
pmarfleet29-Nov-07 1:01
pmarfleet29-Nov-07 1:01 
Questioninsert new row in sql server Pin
break_day28-Nov-07 21:20
break_day28-Nov-07 21:20 
AnswerRe: insert new row in sql server Pin
yaad fridman28-Nov-07 21:51
yaad fridman28-Nov-07 21:51 
GeneralRe: insert new row in sql server Pin
break_day28-Nov-07 22:13
break_day28-Nov-07 22:13 
GeneralRe: insert new row in sql server Pin
yaad fridman28-Nov-07 22:40
yaad fridman28-Nov-07 22:40 
GeneralRe: insert new row in sql server Pin
break_day29-Nov-07 0:01
break_day29-Nov-07 0:01 
GeneralRe: insert new row in sql server Pin
yaad fridman1-Dec-07 20:58
yaad fridman1-Dec-07 20:58 
AnswerRe: insert new row in sql server Pin
ChandraRam28-Nov-07 22:19
ChandraRam28-Nov-07 22:19 
QuestionExport Table to Xml Using Sql Pin
Nagaraju_Focus28-Nov-07 21:09
Nagaraju_Focus28-Nov-07 21:09 
AnswerRe: Export Table to Xml Using Sql Pin
Maharishi Bhatia28-Nov-07 21:56
Maharishi Bhatia28-Nov-07 21:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.