asp.net - Object reference not set to an instance of an object. on my string -


hi have error" object reference not set instance of object." in string constr. mean? answering =)

   private void bindgrid()     {          string constr = configurationmanager                      .connectionstrings["constring"].connectionstring; //error here          sql = "select * logdetails";          sqlconnection con = new sqlconnection(constr);          sqldataadapter sda = new sqldataadapter(sql, con);          datatable t = new datatable();          sda.fill(t);          gridview1.datasource = t;          gridview1.databind();      } 

you need add connection string in web.config file.

<connectionstrings>   <add name="constring" connectionstring="data source=servername;initial catalog=northwind;persist security info=true;userid=username;password=password" providername="system.data.sqlclient" /> </connectionstrings> 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -