我正在使用Vb 2008我已生成自动Genrate Num但我有一些问题 [英] I Am Using Vb 2008 I Have Generate Auto Genrate Num But I Have Some Problem
本文介绍了我正在使用Vb 2008我已生成自动Genrate Num但我有一些问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果在数据库列中为null如何生成下一个自动生成号码我正在使用此代码
if in database column is null how to genrate next auto genrate number i am using this code
Dim cmd As New SqlCommand
cmd.CommandType = CommandType.Text
cmd.Connection = myconn
cmd.CommandText = "select Max(token_no) from billentry"
myconn.Open()
Dim a As Integer = cmd.ExecuteScalar
myconn.Close()
TextBox1.Text = a + 1
推荐答案
您应该处理这样的错误情况。这样做的方法取决于您:例如,您可以使用默认值或向用户提示消息框。
You should handle such an error condition. The way to do that is up to you: you may, for instance, use a default value or prompt a message box to the user.
这篇关于我正在使用Vb 2008我已生成自动Genrate Num但我有一些问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文