Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim cmd As ADODB.CommandPrivate Sub cmdqueding_Click()
Dim strSql As String
strSql = "insert into 用户信息表(id,password,name,memo) values ('" & txtid.Text & "','" & txtmima.Text & "','" & txtname.Text & "','" & txtbeizhu.Text & "') "
rst.MoveFirst
rst.Find "id='" & txtid.Text & "'"
On Error GoTo myerr
If rst.EOF = False Then
MsgBox "用户名存在,请选择别的用户名!", vbExclamation + vbOKOnly
txtid.Text = ""
txtid.SetFocus
Else
If txtmima.Text <> txtqueren.Text Then
MsgBox "密码和确认密码不一样,重新输入.", vbExclamation + vbOKOnly
txtmima.Text = ""
txtqueren.Text = ""
txtmima.SetFocus
Else
cmd.CommandText = strSql 错误 这里 程序运行到这里就停止了
cmd.Execute
If MsgBox("添加成功", vbOKOnly) = vbOK Then
FrmAddyh.Hide
End If
End If
End If
Exit Sub
myerr:
End SubPrivate Sub Form_Load()Set cnn = New ADODB.Connection
cnn.ConnectionString = "filedsn=personnel.dsn;uid=sa;pwd=sa"
cnn.Open
Set rst = New ADODB.Recordset
rst.ActiveConnection = cnn
rst.Source = "用户信息表"
rst.CursorType = adOpenDynamic
rst.Open
Set cmd = New ADODB.Command
cmd.ActiveConnection = cnn
End SubPrivate Sub Form_Resize()
Me.Width = 5000
Me.Height = 7000
End Sub
Dim rst As ADODB.Recordset
Dim cmd As ADODB.CommandPrivate Sub cmdqueding_Click()
Dim strSql As String
strSql = "insert into 用户信息表(id,password,name,memo) values ('" & txtid.Text & "','" & txtmima.Text & "','" & txtname.Text & "','" & txtbeizhu.Text & "') "
rst.MoveFirst
rst.Find "id='" & txtid.Text & "'"
On Error GoTo myerr
If rst.EOF = False Then
MsgBox "用户名存在,请选择别的用户名!", vbExclamation + vbOKOnly
txtid.Text = ""
txtid.SetFocus
Else
If txtmima.Text <> txtqueren.Text Then
MsgBox "密码和确认密码不一样,重新输入.", vbExclamation + vbOKOnly
txtmima.Text = ""
txtqueren.Text = ""
txtmima.SetFocus
Else
cmd.CommandText = strSql 错误 这里 程序运行到这里就停止了
cmd.Execute
If MsgBox("添加成功", vbOKOnly) = vbOK Then
FrmAddyh.Hide
End If
End If
End If
Exit Sub
myerr:
End SubPrivate Sub Form_Load()Set cnn = New ADODB.Connection
cnn.ConnectionString = "filedsn=personnel.dsn;uid=sa;pwd=sa"
cnn.Open
Set rst = New ADODB.Recordset
rst.ActiveConnection = cnn
rst.Source = "用户信息表"
rst.CursorType = adOpenDynamic
rst.Open
Set cmd = New ADODB.Command
cmd.ActiveConnection = cnn
End SubPrivate Sub Form_Resize()
Me.Width = 5000
Me.Height = 7000
End Sub
解决方案 »
- LISTBOX 如何自动滚动到最后?
- 考虑到PureBasic咱们国家用的人少,所以我把找到的正式版本公开吧!
- 我想学VB!
- 在VB里ListView的CHECKBOXS怎么让它变成不可用的!!!!!
- 脚本编写
- 请问"select *from aaa" aaa为一变量如何写?
- 報表有個分組合計功能.那在程序中該怎麼做呢?我只要得到它的合計.
- 请教:关于VB自带报表控件,在一个数据环境中定义多个命令时:对于一个报表仅可正常打开一次,第二次打开时报错"动作不允许当对象打开时";该
- 讲讲你们做报表是用什么控件,DataReporter?CrystalReport?还有做表格又喜欢用哪个控件啊?
- 如何屏蔽SQL Server7.0数据库的有效性校验错误提示?
- 如何让组合框文本窗口中的文字居中显示
- vb.net的treeview使用
具体错误是什么?