Click here to Skip to main content
15,896,489 members
Home / Discussions / C#
   

C#

 
GeneralRe: reading from different files asynchronously Pin
igalep13229-Jun-11 19:57
igalep13229-Jun-11 19:57 
AnswerRe: reading from different files asynchronously Pin
Shameel30-Jun-11 1:02
professionalShameel30-Jun-11 1:02 
QuestionGet Current Identity value of the table using LINQ. Pin
madhubabu29-Jun-11 6:41
madhubabu29-Jun-11 6:41 
AnswerRe: Get Current Identity value of the table using LINQ. Pin
Dave Kreskowiak29-Jun-11 7:22
mveDave Kreskowiak29-Jun-11 7:22 
GeneralRe: Get Current Identity value of the table using LINQ. Pin
madhubabu29-Jun-11 8:05
madhubabu29-Jun-11 8:05 
GeneralRe: Get Current Identity value of the table using LINQ. Pin
AspDotNetDev29-Jun-11 8:56
protectorAspDotNetDev29-Jun-11 8:56 
GeneralRe: Get Current Identity value of the table using LINQ. Pin
madhubabu29-Jun-11 9:44
madhubabu29-Jun-11 9:44 
GeneralRe: Get Current Identity value of the table using LINQ. Pin
Dave Kreskowiak29-Jun-11 9:35
mveDave Kreskowiak29-Jun-11 9:35 
You've still got a problem. Unless you return the ID number in the same sceop as the SQL INSERT you can get back the wrong ID number. Your SQL INSERT statement has to be followed by a SELECT SCOPE_IDENTITY(), like this in order to return the correct ID number:
INSERT INTO tablename (fields) VALUES (values);
SELECT SCOPE_IDENTITY() AS [LastIdentity];

It's better to do this as a stored procedure than to assemble it and use it with ExecuteQuery directly with this batch.

When your INSERT code runs, it'll automatically return the identity value that was assigned to back to you, without having to worry about another user screwing things up by inserting another record in the table between the first users trips to the database.

GeneralRe: Get Current Identity value of the table using LINQ. Pin
AspDotNetDev29-Jun-11 8:55
protectorAspDotNetDev29-Jun-11 8:55 
GeneralRe: Get Current Identity value of the table using LINQ. Pin
Dave Kreskowiak29-Jun-11 9:25
mveDave Kreskowiak29-Jun-11 9:25 
GeneralRe: Get Current Identity value of the table using LINQ. Pin
madhubabu29-Jun-11 9:47
madhubabu29-Jun-11 9:47 
GeneralRe: Get Current Identity value of the table using LINQ. Pin
Dave Kreskowiak29-Jun-11 10:38
mveDave Kreskowiak29-Jun-11 10:38 
GeneralRe: Get Current Identity value of the table using LINQ. Pin
madhubabu29-Jun-11 10:55
madhubabu29-Jun-11 10:55 
SuggestionRe: Get Current Identity value of the table using LINQ. Pin
AspDotNetDev29-Jun-11 7:36
protectorAspDotNetDev29-Jun-11 7:36 
AnswerRe: Get Current Identity value of the table using LINQ. Pin
PIEBALDconsult29-Jun-11 15:02
mvePIEBALDconsult29-Jun-11 15:02 
AnswerRe: Get Current Identity value of the table using LINQ. Pin
#realJSOP30-Jun-11 1:32
professional#realJSOP30-Jun-11 1:32 
QuestionDatagridview Arabic Localization? C# 2010 Application Pin
Paramu197329-Jun-11 5:11
Paramu197329-Jun-11 5:11 
AnswerRe: Datagridview Arabic Localization? C# 2010 Application [modified] Pin
Not Active29-Jun-11 5:37
mentorNot Active29-Jun-11 5:37 
AnswerRe: Datagridview Arabic Localization? C# 2010 Application Pin
DoctorMick29-Jun-11 5:45
DoctorMick29-Jun-11 5:45 
GeneralRe: Datagridview Arabic Localization? C# 2010 Application Pin
Paramu197329-Jun-11 19:30
Paramu197329-Jun-11 19:30 
QuestionWCF Service Browsable through any Web Browser Pin
logicon29-Jun-11 4:36
logicon29-Jun-11 4:36 
AnswerRe: WCF Service Browsable through any Web Browser Pin
Richard MacCutchan29-Jun-11 5:46
mveRichard MacCutchan29-Jun-11 5:46 
AnswerRe: WCF Service Browsable through any Web Browser Pin
DoctorMick29-Jun-11 5:48
DoctorMick29-Jun-11 5:48 
GeneralRe: WCF Service Browsable through any Web Browser Pin
Mirko198029-Jun-11 5:51
Mirko198029-Jun-11 5:51 
Questionconvert a DataTable to a multi-line graph in c# Pin
Jordao8529-Jun-11 4:13
Jordao8529-Jun-11 4:13 

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.