sql server - System.Data.SqlClient.SqlException error at asp.net -


i new @ asp.net. trying database connection. getting error. please advice me. enter image description here

using system; using system.collections.generic; using system.data.sqlclient; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols;  namespace webapplication1 {     public partial class webform1 : system.web.ui.page     {         protected void page_load(object sender, eventargs e)         {            string cs = "data source=.;initial catalog=test;integrated security=sspi";            sqlconnection con = new sqlconnection(cs);            sqlcommand comma = new sqlcommand("select * try", con);            con.open();            gridview1.datasource = comma.executereader();            gridview1.databind();            con.close();          }     } } 

the issue connection string using.

data source=.;initial catalog=test;integrated security=sspi 

check sql server instance name running on local.

data source=**.\yourinstancename**;initial catalog=test;integrated security=sspi 

you can test connection string validity trying add connection in server explorer (tools -> connect server - vs2015).

good luck


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -