iamusingvisualstudio 2010 with MySQL server,theconnectioninworkbenchisworkingproperlybutwheniamtryingtoconnectmysqlinmyapplication
what is the reason behind it?
iamusingfollowingconnectionstringtoconnect、
and below code to use it,con.connectionstring=@ ' server=localhost; database=his_db; uid=根; PWD=根; persistsecurityinfo=True ';
代码:
cmd=newmysqlcommand (selectdistinctfrom _ store _ name from indent _ details ),con );
table=new DataTable (;
adapter=newmysqldataadapter (cmd;
adapter.fill(table;
Foreach(datarowrowintable.rows ) )
{
stringfrmstore=row [ ' from _ store _ name ' ].tostring (;
txtfrom store.items.add (frmstore );
}
trysettingupaconnectioninvswiththeserverexplorerpane :
1 )打开服务器资源管理器。
2 ) right click ' data connections ' and select ' add connection '
3 ) In the dialog that follows,select your DataSource,and database,specify the security info,andpressthe ' test connection ' buttttion
4 ) When the connection works,press 'OK '
5
服务器=localhost; 端口=3306; 轮询=假; Database=DBname; uid=根; pwd=';