C#-Error 26- Locating Server/Instance Specified -
i attempting run program gets data remote sql server, when run program debugger says "error locating server/instance specified"
i searched web , stack overflow , tried many things, nothing worked!
what doing wrong here?
private void txtsearch_click(object sender, eventargs e) { sqlconnection conn = new sqlconnection("server=.\\mssqlserver;attachdbfilename = c:\\program files\\microsoft sql server\\mssql11.mssqlserver\\mssql\\data\\education.mdf; database= education;trusted_connection=yes;"); datatable dt = new datatable(); sqldataadapter sda = new sqldataadapter("select * education nationalkey "+ txtnationalkey.text, conn); sda.fill(dt); datagridview1.datasource = dt; }
i tried mssql11,sql express , many other format of string. opened udp port 1434,tcp port 1433 , 7200 too.
.\\
in connection string refer local machine. set ip or machine name of sqlserver machine.
Comments
Post a Comment