|
小女子才刚学,但却总是connect不到MySQL using VB.net,请各位大哥大姐救救我吧。。
其实要import什么library呢?还有要connect,coding是不是要放在region那一带? |
|
|
|
|
|
|
|
发表于 24-1-2007 10:59 AM
|
显示全部楼层
你的 code? 你的 error message? |
|
|
|
|
|
|
|
发表于 24-1-2007 03:15 PM
|
显示全部楼层
这个我也是想问很久了
为何我在 VB6 用 Driver 5.0 就 connect 不到
用 3.51 就 connect 到
我在 MySQL 5.0 reference manual 看到 VB.net 的 connector/net 会有 MySQL classes
而我在 VB.net 看不到 MySQL 的 classes |
|
|
|
|
|
|
|

楼主 |
发表于 25-1-2007 09:49 AM
|
显示全部楼层
原帖由 hooi1983 于 24-1-2007 03:15 PM 发表
这个我也是想问很久了
为何我在 VB6 用 Driver 5.0 就 connect 不到
用 3.51 就 connect 到
我在 MySQL 5.0 reference manual 看到 VB.net 的 connector/net 会有 MySQL classes
而我在 VB.net 看不到 My ...
对。。我的问题就好像你那样咯~~~
不过我用的是vb.net,但是就是怎么也connect不到MySQL.
各位高手,有source code connect to MySQL using vb.net吗??
真的很想知道我的问题出在哪里~~~ |
|
|
|
|
|
|
|
发表于 25-1-2007 11:57 AM
|
显示全部楼层
原帖由 夜之星辰 于 25-1-2007 09:49 AM 发表
对。。我的问题就好像你那样咯~~~
不过我用的是vb.net,但是就是怎么也connect不到MySQL.
各位高手,有source code connect to MySQL using vb.net吗??
真的很想知道我的问题出在哪里~~~
你的 code? 你的 error message?
这些都没有提供, 大家怎么知道你的问题出在那里呢?  |
|
|
|
|
|
|
|

楼主 |
发表于 26-1-2007 08:14 AM
|
显示全部楼层
回复 #5 goatstudio 的帖子
哦。。。呵呵~~忘了给。。
Dim MyConString As String = _
"DRIVER={MySQL ODBC 3.51 Driver};" & _
"SERVER=localhost;" & _
"DATABASE=testdb;" & _
"UID=root;" & _
"PASSWORD=rootpassword;" & _
"OPTION=3"
Dim MyConnection As New OdbcConnection(MyConString)
MyConnection.Open()
Dim MyCommand As New OdbcCommand
MyCommand.Connection = MyConnection
我是用这个,但是它却说没有OdbcCommand,OdbcConnection。。。这些东西。。
是不是还欠了些什么?是不是要import些什么library? |
|
|
|
|
|
|
|
发表于 26-1-2007 09:38 AM
|
显示全部楼层
首先, 你有没有安装 MySQL/ODBC connector? 安装后, 有没有建立 DSN?
ODBC 的 connection string 不是那样写的, 你写错了. |
|
|
|
|
|
|
|

楼主 |
发表于 26-1-2007 10:51 AM
|
显示全部楼层
我有装ODBC connector,DSN好像没有建立哦。。请问是怎样建立的?
然后要去vb.net 那边add reference, add odbc reference, rite?
是吗?错了啊。。怪不得有error了,那怎样写才是对的呢?
请问你会connect to ms sql server吗? |
|
|
|
|
|
|
|
发表于 26-1-2007 02:05 PM
|
显示全部楼层
原帖由 夜之星辰 于 26-1-2007 10:51 AM 发表
我有装ODBC connector,DSN好像没有建立哦。。请问是怎样建立的?
然后要去vb.net 那边add reference, add odbc reference, rite?
是吗?错了啊。。怪不得有error了,那怎样写才是对的呢?
请问你会connect t ...
你需要先建立 DSN
Control Panel -> Administrative Tools -> Data Sources (ODBC) -> MySQL
不需要 add reference. 但是你得把 connection string 写对.
类似:
Dim MyConString As String = "DSN=mysqlconn;UID=root;PWS=rootpassword" |
|
|
|
|
|
|
| |
本周最热论坛帖子
|