查看: 1508|回复: 5
|
VB6 conection code 问题
[复制链接]
|
|
我知道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 |
|
|
|
|
|
|
|
发表于 16-11-2004 06:45 PM
|
显示全部楼层
|
|
|
|
|
|
|
楼主 |
发表于 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 |
|
|
|
|
|
|
| |
本周最热论坛帖子
|