Click here to Skip to main content
15,902,840 members
Home / Discussions / C#
   

C#

 
QuestionWhy have insert new must command line "SET IDENTITY_INSERT TableName ON" save in SQL Server? Pin
Member 245846710-Jun-14 17:13
Member 245846710-Jun-14 17:13 
I have a few for example insert new records, when the store must have "SET IDENTITY_INSERT TabeleName ON"; and "SET IDENTITY_INSERT TabeleName OFF"; other examples do not need 2 lines ON and OFF, if I wanted to give my 2 lines to adjust what ? you see the code below:

C#
strSQL = "SET IDENTITY_INSERT TableName ON ";
strSQL = strSQL + "INSERT INTO TableName(USERNAME";
strSQL = ...
strSQL = strSQL + "SET IDENTITY_INSERT TableName OFF";
...
SqlCommand cmd = new SqlCommand(strSQL,cnn);
  try
  {
     cmd.ExecuteNonQuery();
     cnn.Close();
  }
....

AnswerRe: Why have insert new must command line "SET IDENTITY_INSERT TableName ON" save in SQL Server? Pin
Mycroft Holmes10-Jun-14 18:02
professionalMycroft Holmes10-Jun-14 18:02 
AnswerRe: Why have insert new must command line "SET IDENTITY_INSERT TableName ON" save in SQL Server? Pin
Swinkaran10-Jun-14 18:37
professionalSwinkaran10-Jun-14 18:37 
AnswerRe: Why have insert new must command line "SET IDENTITY_INSERT TableName ON" save in SQL Server? Pin
Kornfeld Eliyahu Peter10-Jun-14 20:17
professionalKornfeld Eliyahu Peter10-Jun-14 20:17 
AnswerRe: Why have insert new must command line "SET IDENTITY_INSERT TableName ON" save in SQL Server? Pin
Kumarbs10-Jun-14 20:33
professionalKumarbs10-Jun-14 20:33 
AnswerRe: Why have insert new must command line "SET IDENTITY_INSERT TableName ON" save in SQL Server? Pin
Member 245846711-Jun-14 16:40
Member 245846711-Jun-14 16:40 
QuestionRTF to HTML Converter troubled method Pin
Marnus Steyn10-Jun-14 8:37
Marnus Steyn10-Jun-14 8:37 
AnswerRe: RTF to HTML Converter troubled method Pin
Pete O'Hanlon10-Jun-14 10:11
mvePete O'Hanlon10-Jun-14 10:11 
QuestionBackgroundWorker problem Pin
Member 1053008210-Jun-14 3:19
Member 1053008210-Jun-14 3:19 
AnswerRe: BackgroundWorker problem Pin
Pete O'Hanlon10-Jun-14 3:58
mvePete O'Hanlon10-Jun-14 3:58 
QuestionNot able to use PathGradientBrush in WPF Pin
Member 329381510-Jun-14 1:08
Member 329381510-Jun-14 1:08 
AnswerRe: Not able to use PathGradientBrush in WPF Pin
Pete O'Hanlon10-Jun-14 1:44
mvePete O'Hanlon10-Jun-14 1:44 
AnswerRe: Not able to use PathGradientBrush in WPF Pin
Richard MacCutchan10-Jun-14 2:22
mveRichard MacCutchan10-Jun-14 2:22 
QuestionWPF - Load Gmail contact list in ListView with status icon Pin
Member 102676309-Jun-14 20:35
Member 102676309-Jun-14 20:35 
AnswerRe: WPF - Load Gmail contact list in ListView with status icon Pin
Pete O'Hanlon9-Jun-14 21:12
mvePete O'Hanlon9-Jun-14 21:12 
QuestionA console application to a WPF Pin
bunny039-Jun-14 14:12
bunny039-Jun-14 14:12 
AnswerRe: A console application to a WPF Pin
Dave Kreskowiak9-Jun-14 18:14
mveDave Kreskowiak9-Jun-14 18:14 
AnswerRe: A console application to a WPF Pin
Richard MacCutchan9-Jun-14 20:59
mveRichard MacCutchan9-Jun-14 20:59 
AnswerRe: A console application to a WPF Pin
Manikandan1011-Jun-14 3:26
professionalManikandan1011-Jun-14 3:26 
GeneralRe: A console application to a WPF Pin
bunny0312-Jun-14 6:11
bunny0312-Jun-14 6:11 
QuestionIssue using WHERE clause in LINQ query Pin
Member 102279589-Jun-14 5:11
Member 102279589-Jun-14 5:11 
AnswerRe: Issue using WHERE clause in LINQ query Pin
OriginalGriff9-Jun-14 5:17
mveOriginalGriff9-Jun-14 5:17 
GeneralRe: Issue using WHERE clause in LINQ query Pin
Member 102279589-Jun-14 5:24
Member 102279589-Jun-14 5:24 
AnswerRe: Issue using WHERE clause in LINQ query Pin
Richard Deeming9-Jun-14 5:58
mveRichard Deeming9-Jun-14 5:58 
GeneralRe: Issue using WHERE clause in LINQ query Pin
Member 102279589-Jun-14 7:04
Member 102279589-Jun-14 7:04 

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.