Retrieveing Multiple Tables From Stored Procedure using LINQ
-
Hi There, This Task I Had Done Using Below Code Where I Had Used Simple SQL Connection. Now I Want to do This with Linq to SQL.Can Any one Tell me How to Do This. string name=string.Empty; SqlConnection cn= new SqlConnection("Data Source=ASP4;Initial Catalog=MARKETING;User ID=pank;Password=1234"); SqlCommand cmd =new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "FillMultiCombo"; cmd.Connection = cn; DataSet ds=new DataSet(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); da.Dispose(); cmd.Dispose(); cn.Close(); GridView1.DataSource = ds.Tables[0]; GridView1.DataBind(); GridView2.DataSource = ds.Tables[1]; GridView2.DataBind(); ds.Dispose(); Thanks.
-
Hi There, This Task I Had Done Using Below Code Where I Had Used Simple SQL Connection. Now I Want to do This with Linq to SQL.Can Any one Tell me How to Do This. string name=string.Empty; SqlConnection cn= new SqlConnection("Data Source=ASP4;Initial Catalog=MARKETING;User ID=pank;Password=1234"); SqlCommand cmd =new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "FillMultiCombo"; cmd.Connection = cn; DataSet ds=new DataSet(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); da.Dispose(); cmd.Dispose(); cn.Close(); GridView1.DataSource = ds.Tables[0]; GridView1.DataBind(); GridView2.DataSource = ds.Tables[1]; GridView2.DataBind(); ds.Dispose(); Thanks.