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
Sakthis
NA
50
18.6k
Error in Auto increment ID in C#?
Oct 15 2013 7:25 PM
I am success while increment the id 1 to 10 after that it can't increment, i mean after the 10 while i increment the id it comes 10 only again and again and stored multiple 10 in sql table? i dont know how to resolve it can anyone?
Here enclosed my code :
private void btnAutoID_Click(object sender, EventArgs e)
{
SqlConnection sqlcon = new SqlConnection("Data Source=sakthi\\sqlexpress; Initial Catalog=LoginDetails; Integrated Security=True;");
SqlCommand sqlcmd = new SqlCommand("select isnull(max(empcode), 0) from emp", sqlcon);
{
sqlcon.Open();
object obj = sqlcmd.ExecuteScalar();
sqlcon.Close();
txtEmpCode.Text = (int.Parse(obj.ToString()) + 1).ToString();
}
}
Reply
Answers (
6
)
C# BeginInvoke and Callback
c#.Net, send mail with Infopath form