首页 > 编程知识 正文

如何查看mysql主机地址,连接到MySQL主机

时间:2023-05-04 15:05:22 阅读:106006 作者:34

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=';

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。