Update multiple datasets with update under C #.
Implementation of the data tier the following is an update of 3 tables
sqldataadapter[] Adp1=new SqlDataAdapter [3];
Public DataSet updatedsselect (sqlcommand[] sqlCmd, int count, string[] p)
{
Sets the number of table names and tables.
DataSet inids = new DataSet ();
SqlConnection cnn = SQLCNN;
for (int i = 0; i < count; i++)
{
Adp1[i] = new SqlDataAdapter ();
Sqlcmd[i]. Connection = CNN;
Adp1[i]. SelectCommand = Sqlcmd[i];
DataTable dt = new DataTable ();
Dt. TableName = P[i];
Adp1[i]. Fill (DT);
INIDS.TABLES.ADD (DT);
}
return inids;
}
public int updateds (DataSet ds,int count,string[] p)
{
for (int i = 0; i < count; i++)
{
SqlCommandBuilder a = new SqlCommandBuilder (Adp1[i]);
Try
//{
Adp1[i]. Update (ds. Tables[p[i]]);
//}
catch (Exception) {}
}
return 0;
}
The implementation of the business layer is very simple ... .....