ranveer where u r using sqlcoommand builder using.u jst created instance of it i think u want to say that SqlDataAdapter da= new SqlDataAdapter(select * from table1",conn); DataSet ds = new DataSet(); da.Fill(ds, "table1"); dataGridView1.DataSource = ds; dataGridView1.Databind();
coding for displaying gridview in page i think On 8/18/09, Ranveer Singh <[email protected]> wrote: > > > you can use this code create a table in sql table1 in your project database > darg & drop datagridview1 in your form > > private void button1_Click(object sender, EventArgs e) > { > SqlConnection conn = new SqlConnection("data souurce = .; > database=project;integrated security=true"); > con.open(); > SqlDataAdapter da= new SqlDataAdapter(select * from table1",conn); > SqlCommandBuilder sb = new SqlCommandBuilder(da); > DataSet ds = new DataSet(); > da.Fill(ds, "table1"); > dataGridView1.DataSource = ds; > dataGridView1.DataMember = ds.Tables[0].ToString(); > } > > > > thanks > Ranveer > Mob:9999053836 > > > On 8/18/09, bala murugan <[email protected]> wrote: > > Yashika, > > > > Have this > > Password=password;Persist Security Info=True;User ID=sa;Initial > > Catalog=SharePoint_Config;Data Source=bala\sqlexpress > > > > > > Thanks, > > Bala. > > Mob:9003015803 > > http://balaweblog.wordpress.com > > > > > > > > On Mon, Aug 17, 2009 at 6:18 PM, Yashika <[email protected]> wrote: > > > >> SqlConnection conn = new SqlConnection("Data Source='MOI-PC/ > >> SQLEXPRESS';Initial Catalog =project;User > >> > >> ID=sa;Password=madurai;"); > >> > >> > >> On 8/16/09, stanlei <[email protected]> wrote: > >>> > >>> > >>> is there anything wrong with this ... > >>> SqlConnection conn = new SqlConnection("Data Source='MOI-PC/ > >>> SQLEXPRESS';Initial Catalog =project;Integrated Security=SSPI;User > >>> ID=sa;Password=madurai;"); > >>> > >> > >> > > >
