佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 1439|回复: 5

VB6 conection code 问题

[复制链接]
发表于 16-11-2004 06:15 PM | 显示全部楼层 |阅读模式
我知道vb link acess 有两方发
one is jet one is ODBC

i forget the coding alrsady anyone can helpm me??
i use odbc connection ,but i forget the rest follow coding ,plese help

Dim CN As New ADODB.Connection
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
回复

使用道具 举报


ADVERTISEMENT

发表于 16-11-2004 06:45 PM | 显示全部楼层
这里有个VB+Access的例子
http://www.21code.com/codebase/?&pos=down&id=1839
回复

使用道具 举报

 楼主| 发表于 16-11-2004 07:15 PM | 显示全部楼层
Dim CN As New ADODB.Connection
Dim rsPs As New ADODB.Recordset

CN.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Persist Security Info=False; Data Source=" & App.Path & _
    "\POS.mdb"
CN.Open

when i compile it display error "Provider=Microsoft.Jet.OLEDB.4.0 is invalid command.,is it need dl the jet provoder??..

i need open connection,please help me, i dun want use jet i want use odbc

last time i use odbc more easy

the comand is below,i forget liao,please kindly help

Dim cn as new adodb.conection
Dim rs as new adodb.recorbset

cn.open "datasourc:exxxxxxxxxxxxxxx"

[ Last edited by dickson on 16-11-2004 at 07:20 PM ]
回复

使用道具 举报

发表于 17-11-2004 09:31 AM | 显示全部楼层
用 ODBC 的话, 你先去 create 一个 DSN.
然后你的 connection string 就是这样: "DSN=YOUR_MDN_DSN;UID=;PWD=;"
如果你有用 user id/password, 就填上咯.
回复

使用道具 举报

 楼主| 发表于 17-11-2004 12:11 PM | 显示全部楼层
goatstudio 于 17-11-2004 09:31 AM  说 :
用 ODBC 的话, 你先去 create 一个 DSN.
然后你的 connection string 就是这样: "DSN=YOUR_MDN_DSN;UID=;PWD=;"
如果你有用 user id/password, 就填上咯.


Dim Cn As New ADODB.Connection
Dim rsPs As New ADODB.Recordset

'open admin connection
Cn.ConnectionString = "DSN=data;UID=;PWD=;"

it display invalid outside procedure error

can u give me complete code ??thanks your help
回复

使用道具 举报

发表于 17-11-2004 02:11 PM | 显示全部楼层
dickson 于 17-11-2004 12:11 PM  说 :


Dim Cn As New ADODB.Connection
Dim rsPs As New ADODB.Recordset

'open admin connection
Cn.ConnectionString = "DSN=data;UID=;PWD=;"

it display invalid outside procedure error
...


先做一个简单的 select 吧.

Dim rs As New ADODB.Recordset
rs.ActiveConnection = "DSN=data"
rs.Source = "SELECT * FROM your_table"
rs.Open

While Not rs.EOF
  ' display watever data
Wend

rs.Close
Set rs = Nothing
回复

使用道具 举报

Follow Us
您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 25-5-2024 10:28 PM , Processed in 0.062048 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表