strsql ="insert into kehu(company_name,beizhu) values ('"&txtEmp_name.Text &"','"beizhu.Text &"')"
再请教一问题:在公共模块中添加如下代码:
Option Explicit
Public dbconn As New ADODB.Connection
Public loginuser As String
Public loginOK As Boolean
Public cmdtype As String
Public tuser_id As String
Public tdept_id As Integer
Public temp_id As Integer
Public tcheck_ym As String
Public tqx As String
Sub main()
If connecttodatabase = False Then
MsgBox "联接数据库出错!"
End
End If
loginOK = False
cmdtype = " "
frmLogin.Show vbModal
Unload frmLogin
If loginOK Then
MDIForm1.Show
End If
End Sub
'联接到数据库
Function connecttodatabase() As Boolean
On Error GoTo err_conn
'设置服务器名称,数据库名称,登录名(此时密码为空)
dbconn.ConnectionString = "dsn=rsgl;database=kehu;uid=admin;pwd="
dbconn.Open
connectodatabase = True
Exit Function
err_conn:
connecttodatabase = False
End Function
我想请教一下红色字体在代码中的意义。
我运行了一下上面的代码,发现出现错误,说这个frmLogin变量未定义。
我不明白。请教各位了。谢谢 !