我想重置增量值時,我從數據庫表中刪除值。 Pno
是主鍵,這是我迄今爲止嘗試過的代碼我想重置自動增量值,當我從數據庫表中刪除一些行
private void txtincr()
{
int a;
if (txtPno.Text == "")
{
if (con.State == 0)
{
con.Open();
}
string str = "select Pno from Patient_Reg";
SQLiteDataAdapter da = new SQLiteDataAdapter(str, con);
DataSet ds = new DataSet();
da.Fill(ds);
if (ds.Tables[0].Rows.Count != 0)
{
a = ds.Tables[0].Rows.Count;
a = a + 1;
txtPno.Text = Convert.ToString(a);
txtpname.Focus();
}
else
{
txtPno.Text = "1";
txtpname.Focus();
}
con.Close();
}
}
爲什麼你需要這樣做? – 2015-02-06 08:22:13
我是唯一一個找不到問題的人嗎?請多解釋一下 - 何時何地你想重置 – shikjohari 2015-02-06 08:22:19