[求助]不懂就问
Private Sub Command1_Click()
'添加一个联系人
Dim adors As New Recordset
Dim strSQL As String
adors.ActiveConnection = ADOcn
strSQL = "select * from phone where 姓名='" + Text1.Text + "'" '这句会出错,但取消后面的姓名=就没问题,这是怎么了
adors.Open strSQL
If adors.EOF Then
strSQL = "insert into phone(联系人,QQ,手机,座机,出生日期)"
strSQL = strSQL + "values('" + Text1 + "'," + "'" + Text2 + "'," + "'" + Text3 + "'," + "'" + Text4 + "'," + "'" + Text5 + "')"
ADOcn.Execute strSQL
Else
MsgBox "此用户已存在,不能新增!", vbOKOnly + vbCritical, "警告"
End If
'更新并关闭
frmPhone.MSFlexGrid1.Refresh
Unload Me
End Sub