Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

i want to remove data from gridview after data is stored in other table

$
0
0

i want to remove data from gridview after data is stored in other table.. By my code only first row data is remove from gridview other is avilable ... my code is that:

void gridshw2(){
        cn.Open();
        s ="Select * from persn_info";try{
            da =newOleDbDataAdapter(s, cn);DataSet ds =newDataSet();
            da.Fill(ds,"set");
            dataGridView2.DataSource= ds;
            dataGridView2.DataMember="set";

            s ="select sub_no from paymnt_info";
            cm =newOleDbCommand(s, cn);
            rd = cm.ExecuteReader();if(rd.Read()){if(rd["sub_no"].ToString()== dataGridView2.Rows[].Cells[0].Value.ToString()){
                        dataGridView2.Rows.RemoveAt(0);}}}catch(Exception ea){MessageBox.Show(ea.Message);}finally{
            cn.Close();}}


Viewing all articles
Browse latest Browse all 2535

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>