c# - Connecting to SQL Server using windows authentication -


when trying connect sql server using following code

     sqlconnection con = new sqlconnection("server= localhost, authentication=windows authentication, database= employeedetails");      con.open();      sqlcommand cmd;      string s = "delete employee empid=103"; 

i following 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: 25 - connection string not valid)

a connection string sql server should more like: "server= localhost; database= employeedetails; integrated security=true;"

if have named instance of sql server, you'll need add well, e.g., "server=localhost\sqlexpress"


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -