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
Durga Velusamy
NA
318
114.6k
increment with last id
Apr 10 2015 1:23 AM
increment with last id , how to get the counted value of particular field in a variable to perform some function using the counted value. {
SqlConnection con = newSqlConnection(@"server=CSE-PC; integrated security=true; Database=Bas");
con.Open();
SqlCommand com = newSqlCommand("select top(1) SUBSTRING(CustomerId,1,0) as Last_Id from devi order by Last_Id desc", con);
strc00 = com.ExecuteScalar().ToString();
com.ExecuteNonQuery();
here i have gave code like this but it does not work any one please give syntax for this question.
if (i == 0) here I need to increment with last id how to get the counted value in a variable.
{
strc00 = "001";
}
else
{
int j = i + 1;
strc00 = "001" + j.ToString();
}
comboBox1.Items.Add(strc00);
i++;
MessageBox.Show("Id Created");
con.Close();
}
}
Reply
Answers (
6
)
Delete all row accept 1 from selected total rows in sql
give suggestion to install sql server