mysql - Can not connect to local database with c# System.Data.SqlClient -


i have problems connecting local db using c# system.data.sqlclient.

information:

  • db parameters: name:baza host:localhost instance:baza port:3306 schema:world
  • my connection string: @"server=localhost\baza;password=pass;user id=root;database=world;persist security info=true"
  • using: c#, system.data.sqlclient, mysql workbench
  • firewall off
  • succesfull conection jdbc, server working

jdbc parameters:

string url = "jdbc:mysql://localhost:3306/"; string driver = "com.mysql.jdbc.driver"; string dbname = "world"; string username = "root"; string pass = "pass"; 

problem:

  • when use conn.open(); happen => (provider: sql network interfaces, error: 26 - error locating server/instance specified)

tried:

i have no idea do... sth server name.

edit: code:

string connstr = @"data source=localhost\baza;password=qspass;user id=root;"+     "initial catalog=world;persist security info=true";  console.writeline(connstr);  sqlconnection conn = new sqlconnection(conbuild.connectionstring); conn.open();  console.writeline("yo!"); more code... 

never reached yo! :p

i suppose should put answer in answer section, rather comment :)

i see jdbc connection string using mysql rather sql server.

the system.data.sqlclient namespace the.net framework data provider sql server, not mysql.

if using mysql, need use mysql ado.net driver available here:

download connector/net


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -