TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dong Lam Trien
830
986
147.2k
Why insert new have must "SET IDENTITY_INSERT TableName ON"
Jun 10 2014 11:36 PM
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:
strSQL = "SET IDENTITY_INSERT TabUsername ON ";
strSQL = strSQL + "INSERT INTO TabUsername(USERNAME";
strSQL = ...
strSQL = strSQL + "SET IDENTITY_INSERT TabUsername OFF";
...
SqlCommand cmd = new SqlCommand(strSQL,cnn);
try
{
cmd.ExecuteNonQuery();
cnn.Close();
}
....
Reply
Answers (
3
)
if else statement in XElement
How to split path in c#