//string connection="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\aspnet.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True"; string connection = "Data Source=path;Initial Catalog=commonlogin;User ID=sa;Password=; "; SqlConnection conn = new SqlConnection(connection); conn.Open(); SqlDataAdapter ad= new SqlDataAdapter("SELECT * FROM tbl_SqlImage", conn); Dataset ds=new Dataset(); ad.fill(ds); if(ds.tables[0].rows.count!=0) { Gridview1.Datasource=ds; Gridview1.Databind(); }
try { using (SqlConnection sqlConn = new SqlConnection(strConn)) { using (SqlCommand sqlCmd = new SqlCommand()) { sqlCmd.CommandText = "SELECT * FROM login"; sqlCmd.Connection = sqlConn; sqlConn.Open(); SqlDataReader objDataReader = sqlCmd.ExecuteReader(); gvDetail.DataSource = objDataReader; gvDetail.DataBind(); sqlConn.Close(); } } } catch { }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)