public void UpdateContactTableByDataSet(DataSet dsstring strTblName)
{
try
{
SqlDataAdapter myAdapter = new SqlDataAdapter();
SqlConnection conn = new SqlConnection(strConnection);
SqlCommand myCommand = new SqlCommand(select * from strTblNameconn);
myAdapterSelectCommand = myCommand;
SqlCommandBuilder myCommandBuilder = new SqlCommandBuilder(myAdapter);
connOpen();
SqlTransaction myTrans = connBeginTransaction();
myCommandTransaction = myTrans;
try
{
myAdapterUpdate(dsstrTblName);
myTransCommit();
}
catch(Exception e)
{
try
{
myTransRollback();
}
catch (SqlException ex)
{
if (myTransConnection != null)
{
ConsoleWriteLine(回滚失败! 异常类型: + exGetType());
}
}
}
finally
{
connClose();
}
}
catch(Exception ex)
{
throw ex;
}
}