alt text http://www.imagechicken.com/uploads/1265914403006619100.jpg自動遞減使用C#
如何自動遞減添加允許每次分配給每個學生一個部分學生的數量?
我有代碼,但它有一個錯誤。
private void btnAssign_Click(object sender, EventArgs e)
{
////for auto increment
ds = DBConn.getStudentDetails("sp_Retrieve_Student_Section");
int cnt = ds.Tables[0].Rows.Count;
string lastrec = ds.Tables[0].Rows[cnt+1][1].ToString();
int newpcode = int.Parse(lastrec) - 1;
txtAllowed.Text= newpcode.ToString();
}
psst,不要使用sp作爲存儲過程的前綴。 – blu 2010-02-11 18:13:49
聞起來像作業... – 2010-02-11 18:14:01
你已經問過這個問題(http://stackoverflow.com/questions/2242053/how-to-autoincrement-in-c)和其他許多人(http://stackoverflow.com/用戶/ 252490/malou17)。 – jason 2010-02-11 18:16:02