Look at the following:

int myTableCnt = ds.Tables["myTable"].Rows.Count;
int myTable1Cnt = ds.Tables["myTable1"].Rows.Count;

and

 for (int i = 0; i < 5  ; i++) 
{
    dr = dt.NewRow();
    DataRow dr01 = ds.Tables["myTable"].Rows[i];

dr[0]=dr01["oName"].ToString();
dr[1]=dr01["oEmail"].ToString();
dr[2]=dr01["myTable"].ToString();

    dt.Rows.Add(dr);
   }


Let me know if this is correct.


- Subramanya K Vemuri-Venkata.







  ----- Original Message ----- 
  From: Arindam 
  To: [EMAIL PROTECTED] 
  Sent: Tuesday, May 25, 2004 10:11 AM
  Subject: [AspNetAnyQuestionIsOk] HOw do i get the values of a column in my data Table



  Hello All I have 2 question to ask 
  1. HOw do i get the number of row count ?
  2. HOw do i get the values of a column in   my data Table



  ICollection MakeGridSet() 
    {

     myConnection mycon=new myConnection();
     mycon.openConnection();
     
     string strsql;
     strsql="Select oName ,oEmail,oCountry from regDtls";  
     string strsql2;
     strsql2="Select oEmail,oPassword,nTrydate from regUserlogin";

    file://SqlCommand sqlCom = new SqlCommand(strsql, mycon.mysqlconn);
     SqlDataAdapter sqlAdap=new SqlDataAdapter(strsql, mycon.mysqlconn);  
     SqlDataAdapter sqlAdap1=new SqlDataAdapter(strsql2, mycon.mysqlconn);
    
     DataSet ds = new DataSet();
     sqlAdap.Fill(ds,"myTable"); 
     sqlAdap1.Fill(ds,"myTable1"); 
  file://************************************
     DataTable dt = new DataTable();
     DataRow dr;

     dt.Columns.Add(new DataColumn("Name", typeof(string)));
     dt.Columns.Add(new DataColumn("Email", typeof(string)));
     dt.Columns.Add(new DataColumn("Country", typeof(string)));

    // here i am trying to get the number of rows ;
    // but "dt.Rows.Count" returns 0

    for (int i = 0; i < 5  ; i++) 
     {
      dr = dt.NewRow();

  dr[0]=ds.Tables["myTable"].Columns["oName"];//here i need the value of the column. 
  dr[1]=ds.Tables["myTable"].Columns["oEmail"];//but it returns name which i dont want
  dr[2]=ds.Tables["myTable"].Columns["oCountry"];
      
      dt.Rows.Add(dr);
     }
    mycon.closeconnection();
     DataView dv = new DataView(dt);
     return dv;
      
    }
    

    
    
    private void Search_Click(object sender, System.EventArgs e)
    {

  
file://ds.Relations.Add("CompanyContacts",ds.Tables["myTable"].Columns["oEmail"],ds.Tables["myTable1"].Columns["oEmail"]);
   

    
     file://DataGrid1.DataSource = ds.Tables["myTable"].DefaultView()  ;
     DataGrid1.DataSource =MakeGridSet() ;
     DataGrid1.DataBind();
     
     file://Counting number of records
     TextBox2.Text=DataGrid1.Items.Count.ToString() ; 
    }



  Regards

  Arindam



  Yahoo! India Matrimony: Find your partner online.

  [Non-text portions of this message have been removed]


        Yahoo! Groups Sponsor 
              ADVERTISEMENT
             
       
       


------------------------------------------------------------------------------
  Yahoo! Groups Links

    a.. To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
      
    b.. To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]
      
    c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 



[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 

Reply via email to