private Boolean dbupdate ()
{< br> string strsql = "select productsspecid, productsspec, productsspecunit, productsid from tbl_product_detail_master ";
system. data. datatable dtupdate = new system. data. datatable ();
dtupdate = This. dbconn (strsql);
dtupdate. rows. clear ();
System. Data. datatable dtshow = new system. Data. datatable ();
// Dtshow = (datatable) This. bindsource. datasource;
Dtshow = (system. Data. datatable) This. dgselect. datasource;
Int p1 = dtshow. Rows. count;
// Try
//{
for (INT I = 0; I {< br> datarowstate rowstate = new datarowstate ();
rowstate = dtshow. rows [I]. rowstate;
If (rowstate = datarowstate. added | rowstate = datarowstate. detached | rowstate = datarowstate. modified)
{
If (this. dgselect ["Del", I]. value. tostring () = "1 ")
{
Dtshow. Rows [I]. Delete ();
}
}
}
For (INT I = 0; I <dtshow. Rows. Count; I ++)
{
Dtupdate. importrow (dtshow. Rows [I]);
}
Int num = dtupdate. Rows. count;
Try
{
This. Conn. open ();
Trans = This. Conn. begintransaction ();
Mysqlcommandbuilder commandbuiler;
Commandbuiler = new mysqlcommandbuilder (this. adapter );
This. adapter. update (dtupdate);
trans. commit ();
This. conn. close ();
}
Catch (exception ex)
{
MessageBox. Show (ex. Message. tostring ());
Trans. rollback ();
Return false;
}
Dtupdate. acceptchanges ();
Return true;
}