c# - Connect to sql database -


i'm trying retrieve data database datagridview i'm getting exception,

the connectionstring property has not been initialized.

using (conn = new sqlconnection(@"data source=(localdb)\v11.0;attachdbfilename=""c:\users\bob\documents\visual studio 2012\projects\login\login\student_marks.mdf"";integrated security=true")); {      using (adap = new sqldataadapter("select * tbl_students_marks", conn))      {           dataset das = new dataset();           adap.fill(das);           datagridview1.datasource = ds.tables[0];      } } 

i see code , found placed ";" , end of first using statement initiating conn

using (conn = new sqlconnection(@"data source=(localdb)\v11.0;attachdbfilename=""c:\users\bob\documents\visual studio 2012\projects\login\login\student_marks.mdf"";integrated security=true"))//; issue {      using (adap = new sqldataadapter("select * tbl_students_marks", conn))      {           dataset das = new dataset();           adap.fill(das);           datagridview1.datasource = das.tables[0];//this must das not ds      } } 

Comments

Popular posts from this blog

Upgrade php version of xampp not success -

amazon web services - S3 and apache mod_proxy with basic authentication -

powershell - This solution contains one or more assemblies targeted for the global assembly cache -