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

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -