hyqd.net
当前位置:首页 >> vB用ACCEss数据库登录 >>

vB用ACCEss数据库登录

以下是模块 ::Public con As New Connection '定义数据连接,公共变量 Public coon, coom As String Public str As Currency Sub main() ChDir App.Path '转换相对路径 con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=

Dim conn As New ADODB.Connection Dim rs As New ADODB.Recordset If user_name.Text = "" Or user_pwd.Text = "" Then MsgBox "用户名,密码不能为空", vbDefaultButton1, "警告" user_name.SetFocus End If conn.Open "

'代码出处:http://zhidao.baidu.com/question/145401203.html'在工程中引用Microsoft ActiveX Data Object 2.6或者更高的版本Dim db As New ADODB.Connection '声明数据库对像Dim rs As New ADODB.Recordset '声明表对像Dim mstream As

首先,我们需要引用ADO.具体的方法是,在"工程" -- "引用" 中,找到"Microsoft ActiveX Data Object *.* Library",这里的"*.*"是指的时ADO的版本号,一般来说,应用程序或ActiveX控件都具有向下兼容性,所以我们尽可能选择比较新

我是这样做的模块Private conn As New ADODB.ConnectionPublic Sub OpenConn() With conn If .State = adStateClosed Then .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "/addresslist.mdb;Persist

有多种连接方式,可以用数据控件连接,也可以用组件连接.下面是用ADO组件来连接的例子(假定ACCESS数据库文件和程序是放在同一个文件夹的):123456789101112131415 PrivateSubForm_Click() '点击窗体运行 Dimconn

1.在引用后,使用New关键字,如 Private Conn As New ADODB.Connection Private Reco As New ADODB.Recordset 2.在没引用时,用CreateObject创建对象: Dim Conn,Reco Set Conn = CreateObject("ADODB.Connection") Set Reco =

Private Sub Cmd_ok()On Error Resume NextDim Psw As StringIf txtuser = "" Or txtpwd = "" Then MsgBox "用户名密码不能为空,请重新输入!", 64, "提示"Else Adodc1.RecordSource = "select * from 登录表 where admin ='" &

请用MICROSOFT jet 4.0 OLE DB Provider引擎连接ACCESS数据库,方法如下: 新建工程时选数据工程,此时VB6集成调试环境左边工具箱内已加载了有关数据库编程必须的控件. 然后在FORM1窗体中添加ADODC控件和DATAGRID控件,

select * from 数据库名称 where 用户名或密码 Adodc.Refresh Adodc.Recordset.RecordCount的值为则错误0,不为零说明正确.

wlbx.net | zxwg.net | lzth.net | 4585.net | 6769.net | 网站首页 | 网站地图
All rights reserved Powered by www.hyqd.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com