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