i have a table and a field like ID(it has been added later) and i want to write to my table's ID field, numbers from 1 to 1000. for this i wrote a code like this
for (int i = 0; i < 75440; i++)
{
baglan.Open();
SqlCommand kmt = new SqlCommand();
kmt.Connection = baglan;
kmt.CommandText = "UPDATE EvrakArsiv SET ID='" + (i + 1) + "' ";
try
{
kmt.ExecuteNonQuery();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
baglan.Close();
}
for (int i = 0; i < 75440; i++)
{
baglan.Open();
SqlCommand kmt = new SqlCommand();
kmt.Connection = baglan;
kmt.CommandText = "UPDATE EvrakArsiv SET ID='" + (i + 1) + "' ";
try
{
kmt.ExecuteNonQuery();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
baglan.Close();
}
But it returns a value on the ID Field: all rows value are same. like 9, like 1745, like 3578 whats my wrong?