1.VBå
³äºACCESSçç¨åºä»£ç
2.VB登陆窗体代码。源码数据库呢是源码access的 数据库名为data 有一个登陆表 有两个字段名 用户名 密码
VBå ³äºACCESSçç¨åºä»£ç
å¨VBèåâè¿ç¨âå¼ç¨âå¯¹è±¡åº "Microsoft ActiveX Data Objects 2.5 Library"
'å®ä¹
Private Sub Command1_Click()
Const connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
dim conn As New ADODB.Connection
dim Rs As New ADODB.Recordset
dim sql As string
conn.Open connStr & "ãæçæ°æ®åºè·¯å¾åæ件.mdbã"
sql = "SELECT * FROM ä½ ç表åå称"
Rs.Open sql, conn, adOpenKeyset, adLockPessimistic
If Not Rs.State = adStateOpen Then 'ç¡®å®æ°æ®åºè½é¡ºå©æå¼åï¼æçç¥è¿ä¸ªå¤æ
MsgBox "æ°æ®åºæ²¡æå¼å¯ãæ£æ¥æ°æ®åºçé¾æ¥æ¯åªå¿åºé®é¢ï¼"
exit sub
End If
âæ°æ®åºè½å¼å¯æä¼ç»§ç»å¾ä¸ä¸è¡è¿è¡
Rs.MoveLast: Rs.MoveFirst
âè¿ä¸è¡åªæ¯æ£æ¥Rsæ¯ä¸æ¯æ£å¸¸è¿è¡ï¼æ´ä½ä»£ç å®æåå¯ä»¥ç§»é¤
MsgBox "è®°å½éæ»å ±ç¬æ°ï¼" & Rs.RecordCount
â æ°æ®åºç¡®å®è½æ£å¸¸å¼å¯äºï¼æ³ç»§ç»æä½æ°å¢ãæ´æ°ãå é¤...é½è¡
'å¼å§æ°å¢ä¸ç¬æ°æ®
'Rs.AddNew
'.......èµå¼ä»£ç
'.......èµå¼ä»£ç .
âRs.Update
'Rs.Refresh
End Sub
VB登陆窗体代码。数据库呢是源码龙头必选源码access的 数据库名为data 有一个登陆表 有两个字段名 用户名 密码
新建vb工程,然后点击“工程”-->“引用”,源码在以下两个选项前挑勾:Microsoft Data Environment Instance 1.0
Microsoft ActiveX Objects 2.5 Library
因为你要用Access数据库,源码安徽网站制作源码所以需要在工程中添加控件。源码截屏溯源码
建立Access数据库,源码在这个vb工程文件夹新建一个文件夹,源码命名为table,源码然后将这个Access数据库文件放入table文件夹中。源码
源代码:
Private Con_Access As Connections
Private Sub Form_Load()
Set Con_Access = New Connection
With Con_Access
.Provider = "microsoft.jet.oledb.4.0"
.ConnectionString = App.Path & "\table\ship.mdb"
.Open
End With
End Sub
Private Sub cmdOK_Click()
Dim cmd As New Command
Dim rd As New Recordset
cmd.ActiveConnection = Con_Access
cmd.CommandText = "select username,源码userpassword from usertable where username='" & Text1.Text & "'"
On Error GoTo db_error
Set rd = cmd.Execute
On Error GoTo 0
If rd.EOF Then
MsgBox "用户名不存在。",源码 vbOKOnly + vbInformation, "错误"
Exit Sub
End If
db_error:
MsgBox Err.Description, vbOKOnly + vbInformation, "错误"
End Sub
Private Sub cmdCancel_Click()
End
End Sub
已经附上截图了,如果还有疑问,源码量化侦查兵源码发电邮给我rearguard_zero@hotmail.com
源码源码