Click here to Skip to main content
15,917,328 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
SqlCommand cmd = new SqlCommand("SELECT * FROM [t_memsch] where [m_memcode]='" + m_memcode_input.Text + "'", conn);
                SqlDataAdapter sda1 = new SqlDataAdapter(cmd);
                DataTable ds1 = new DataTable();

                sda1.Fill(ds1);                

                try
                {   
                    //int temp = ds1.Rows.Count
                    for (int temp = ds1.Rows.Count; temp > 0; temp--)
                    {
                        chk_date(ds1.["m_cname"].ToString());
                        

                        //Console.Write("Temp:", temp);
                        //MessageBox.Show("i m here");
                    }
                     
                }


Hi there, there is a column m_cname in the DataTable, how can i take it out and pass it to the function chk_date? please everyone help.

thanks a lots.
Posted

Hi,

Try the following

C#
try
                {
                    //int temp = ds1.Rows.Count
                    for (int temp = ds1.Rows.Count; temp > 0; temp--)
                    {
                        chk_date(ds1.Rows[temp]["m_cname"].ToString());


                        //Console.Write("Temp:", temp);
                        //MessageBox.Show("i m here");
                    }

                }



Hope this helps.
 
Share this answer
 
Comments
tomy_hkcg 2-Jan-12 22:46pm    
thanks a lot. i forgot the syntax.
use this

C#
ds1.Rows[temp]["m_cname"].ToString();
 
Share this answer
 
v2
Comments
tomy_hkcg 2-Jan-12 22:49pm    
it's done, thanks so much
 
Share this answer
 
Comments
Amir Mahfoozi 3-Jan-12 23:48pm    
+5 interesting link.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900