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:
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
Post a Comment