DataSet ds = new DataSet(); DataTable dtTable1 = new DataTable(); DataTable dtTable2 = new DataTable(); ds.Tables.Add(dtTable1); ds.Tables.Add(dtTable2);
Ds
DataTable dt1 = Ds.Tables[0]; DataTable dt2 = Ds.Tables[1];
DataTable dt1=DataSetObj.Tables[0]; DataTable dt2=DataSetObj.Tables[1];
Public Partial Class WebForm7 Inherits System.Web.UI.Page Public oCn As New System.Data.SqlClient.SqlConnection("Data Source=(local);Initial Catalog=MyDatabase;Uid=sa") Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load fill_data() End Sub Sub fill_data() If oCn.State = ConnectionState.Closed Then oCn.Open() End If Dim dt As New DataTable Dim cmd As New SqlClient.SqlCommand("select * from mst_employees", oCn) Dim da As New SqlClient.SqlDataAdapter(cmd) Dim ds As New DataSet("bpl") Dim i As Integer = 0 dt.Columns.Add(0) dt.Columns.Add(1) dt.Columns.Add(2) dt.Columns.Add(3) da.Fill(ds, "bpl") If ds.Tables(0).Rows.Count > 0 Then While (i <> ds.Tables(0).Rows.Count) dt.Rows.Add() dt.Rows(i).Item(0) = ds.Tables(0).Rows(i).Item(0).ToString dt.Rows(i).Item(1) = ds.Tables(0).Rows(i).Item(1).ToString dt.Rows(i).Item(2) = ds.Tables(0).Rows(i).Item(2).ToString dt.Rows(i).Item(3) = ds.Tables(0).Rows(i).Item(3).ToString i = i + 1 End While End If Me.GridView1.DataSource = dt Me.GridView1.DataBind() oCn.Close() End Sub End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)