C#连接MYSQL的问题

q520525745 2009-02-01 02:25:39
private string connstr = "Driver={MySQL   ODBC   3.51   Driver};server=127.0.0.1;database=root;user=root;password=root;option=3;STMT=set   CHARACTER   SET   gbk";//连接数据库字符串。

提示System.ArgumentException:Keyword not supported错误,谁知道如何解决?
...全文
129 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
txlxxyy 2009-11-22
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 pp_shy 的回复:]
在项目中引用MySql.Data.dll后

连接语句:
C# codestring strConn="Server=localhost;Port=1066;Database=test;Uid=name;Pwd=password;";

MySql.Data.dll这个动态库,网上有下载
[/Quote]
同意
q520525745 2009-02-01
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 mitchy 的回复:]
使用最基本的server=127.0.0.1;user id=root; password=xxx; database=xxx; 四个选项组成的connectstring都无法连接数据库的话,就不是connectstring的问题了 连接mysql数据库需安装ODBC驱动
[/Quote]这个驱动下载了如何跟程序联系起来呢?
mitchy 2009-02-01
  • 打赏
  • 举报
回复
使用最基本的server=127.0.0.1;user id=root; password=xxx; database=xxx; 四个选项组成的connectstring都无法连接数据库的话,就不是connectstring的问题了 连接mysql数据库需安装ODBC驱动
q520525745 2009-02-01
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 q407803120 的回复:]
C# codeserver=127.0.0.1;user id=root; password=xxx; database=xxx; pooling=false;charset=utf8
[/Quote]还是报原来的错.
我这个是用来连接DZ论坛的,是不是跟数据库里面的设置有关?
q407803120 2009-02-01
  • 打赏
  • 举报
回复
server=127.0.0.1;user id=root; password=xxx; database=xxx; pooling=false;charset=utf8
q520525745 2009-02-01
  • 打赏
  • 举报
回复
这个DLL引用了的
pp_shy 2009-02-01
  • 打赏
  • 举报
回复
在项目中引用MySql.Data.dll后

连接语句:

string strConn = "Server=localhost;Port=1066;Database=test;Uid=name;Pwd=password;";


MySql.Data.dll这个动态库,网上有下载

111,130

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧