回复 楼主 ayu_大歌
Dim mConn As ConnectionDim mRst As Recordset 'Recordset 对象
Dim objRst As Recordset 'Recordset 对象
Private Sub Command_登陆_Click(Index As Integer)
'*** 打开access数据库:
Set mConn = CreateObject("ADODB.Connection")
mConn.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
& "C:\Users\admin\Desktop\仓库管理系统\Landed.mdb" & ";;Jet OLEDB:Database password=123"
mConn.Open '打开数据库
Set mRst = CreateObject("ADODB.RecordSet")
mSql = "SELECT * FROM admin" '其中admin为access数据库中的表的名称,下同
Set mRst = mConn.Execute(mSql) '在这1句上卡了
Select Case mConn.State
Case adStateClose
statestring = "adStateClosed"
Case adStateOpen
statestring = "adStateOpen"
End Select
'显示连接的状态
MsgBox "连接成功!", , statestring
[ 本帖最后由 ayu_大歌 于 2013-2-7 22:51 编辑 ]