本文介绍了我设计了regesitration表单,因为我有一个textbox = ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我设计注册表格,因为我有一个文本框= ID,当我怀孕时我想自动获得ID号,如果有人知道请发送代码..................
I design regesitration form in that i have one textbox=ID, when i regester i want to get ID number automatically, if any one know plz send the code............
推荐答案
string maxid = "";
string sql = "Select Top(1) ID_Receipt from Receipt ORDER BY ID_Receipt DESC";
SqlCommand testcommand = new SqlCommand(sql, conn);
rdr = testcommand.ExecuteReader();
while (rdr.Read())
{
maxid = rdr["ID_Receipt"].ToString();
}
int nummaxid = Convert.toInt32(maxid);
nummaxid++;
textbox1.Text = nummaxid.toString();
如果您的ID有字符串,则可以使用split函数
祝你好运.请标记是否回答
if your id have string you maybe use function split
Good luck. Pls Mark if answer
这篇关于我设计了regesitration表单,因为我有一个textbox = ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!