SQL Server with C# -


i writing program connects sql server (igor-pc - sql server 10.50.4044 - instance igor-pc\igor)

the code this:

sqlconnection myconnection = newsqlconnection("server=.\\igor;database=prueba");  myconnection.open(); 

but error:

a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 26 - error locating server/instance specified)

not monitored system.data.sqlclient.sqlexception

thanks!

try this

sqlconnection myconnection = new sqlconnection("data source=igor;initial catalog=prueba;integrated security=true"); 

edit2:

enter image description here

for above picture , test_db database connection string should written as

 sqlconnection myconnection = new sqlconnection("data source=ajmot-pc;user id=sa;password=thisismypassword;initial catalog=test_db;integrated security=true"); 

if using window authentication sql server don't need declare user id=sa;password=thisismypassword section.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -