Home > Software engineering >  A great god help: tips [Miscrosoft] [ODBC driver manager] did not find the data source name and spec
A great god help: tips [Miscrosoft] [ODBC driver manager] did not find the data source name and spec

Time:11-17

Private Sub Form_Load ()
'define and create database connection and access objects
Dim cn As New ADODB. Connection
Dim the rs As New ADODB. You
'define the database connection string variable
Dim strCn As String
'define the data flow connection parameters variable
Dim db_host As String
Dim db_user As String
Dim db_pass As String
Dim db_data As String
'define the Sql statement
Dim As SQL String
'initialize database connection variable
Db_host="localhost"
Db_user="root"
Db_pass=""
Db_data="https://bbs.csdn.net/topics/up"
Cn. The ConnectionString="DRIVER={MySQL ODBC DRIVER 8.0};" & _
"SERVER=" & amp; Db_host & amp; ";" & _
"The DATABASE=" & amp; Db_data & amp; ";" & _
"UID=" & amp; Db_user & amp; "; The PWD="& amp; Db_pass & amp; ";" & _
"OPTION=3; STMT=SET NAMES GB2312 "
Cn. Open strCn
Cn. CursorLocation=adUseClient
'access to the table test
SQL="select * from the up"
Rs. The Open SQL, cn
MsgBox rs. RecordCount
End Sub

CodePudding user response:

Newbie on the road, the great god guide, please

CodePudding user response:

The specific type of database connection? If it is used to suggest not to use the odbc
  • Related