how to join two datatable datas into one datatable to show in one gridview in asp.net

后端 未结 4 1553
感情败类
感情败类 2020-12-11 05:55

how to join two datatable datas into one datatable to show in one gridview

i.e in 1 datatable i have username and pwd and in another datatable i have that user detai

相关标签:
4条回答
  • 2020-12-11 06:18

    @Ranjana have a look at this MSDN article it deals with what you want..

    0 讨论(0)
  • 2020-12-11 06:21

    What you need is a join on the tables before reading them into a DataTable: SQL Joins

    0 讨论(0)
  • 2020-12-11 06:23

    You can merge two datatable, here is the sample for that. http://msdn.microsoft.com/en-us/library/system.data.datatable.merge.aspx

    0 讨论(0)
  • 2020-12-11 06:32
    on=new SqlConnection("Data Source=MCN101; Initial Catalog=MergeTable; Uid=sa; pwd=");
    da = new SqlDataAdapter("Select * from Table1", con);
    da.Fill(ds1, "Record");
    da = new SqlDataAdapter("select * from Table2", con);
    da.Fill(ds2, "Record");
    ds1.Merge(ds2);
    GridAllRecord.DataSource = ds1;
    GridAllRecord.DataBind();
    
    0 讨论(0)
提交回复
热议问题