private void button2_Click_1(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"server=CSE-PC; integrated security=true; Database=Bas");
con.Open();
the below code need to check with database .i.e the colum :ID if it is count 0 means excute else contion otherwise starts with if condition. How to check this ?
if (i > 0)
{
int j = i + 1;
strc00 = "C00" + j.ToString();
}
else
{
strc00 = "C001";
}
comboBox1.Items.Add(strc00);
i++;
MessageBox.Show("id created");
}

Joginder BangerPosted Mar 31, 2015, 4:20 PM
i think this trick is useful for solve your problem. First of all get a database Name like this type
string word = server.substring(0, 3);
In word have first three word for example
Database name testing. we take first three word only. tes
if (i > 0)
{
int j = i + 1;
strc00 = word + j.ToString();
}
else
{
strc00 = word ;
}
comboBox1.Items.Add(strc00);
i++;
I hope not worry about the fixed the c00.
SL GPosted Mar 31, 2015, 9:16 AM
Maximum Number Get From DataBase & Add 1 To Get automatic Generate Id
Get Result Add + 1
Or Refer Below Links
http://dotnetdrizzles.blogspot.in/2015/03/find-maximum-number-from-database-table.html
http://screenshotdrizzles.blogspot.in/2015/03/find-maximum-number-from-database-table.html