本文整理匯總了C#中System.Data.DataTable.GetChanges方法的典型用法代碼示例。如果您正苦於以下問題:C# DataTable.GetChanges方法的具體用法?C# DataTable.GetChanges怎麽用?C# DataTable.GetChanges使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Data.DataTable
的用法示例。
在下文中一共展示了DataTable.GetChanges方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GeneratorCommand
/// <summary>
///
/// </summary>
/// <param name="connectionName"></param>
/// <param name="dbTableName"></param>
/// <param name="table"></param>
/// <returns></returns>
public static List<SqlCommandObject> GeneratorCommand(string connectionName, string dbTableName, DataTable table, DataRowState state)
{
if (connectionName.IsEmpty())
throw new Exception("GeneratorCommand方法中的connectionName為空.");
List<SqlCommandObject> cmds = new List<SqlCommandObject>();
if (table.IsEmpty())
return cmds;
InsertCommandGenerator insertCommandGenerator = new InsertCommandGenerator();
DeleteCommandGenerator deleteCommandGenerator = new DeleteCommandGenerator();
UpdateCommandGenerator updateCommandGenerator = new UpdateCommandGenerator();
SqlCommandObject cmd = null;
if (table != null)
{
DataTable dtChanges = null;
if (state == DataRowState.Unchanged)
{
dtChanges = table.GetChanges();
}
else
{
dtChanges = table.GetChanges(state);
}
if (dtChanges == null) return cmds;
if (dbTableName.IsEmpty())
throw new Exception("GeneratorCommand方法中的tableName為空.");
foreach (DataRow dr in dtChanges.Rows)
{
switch (dr.RowState)
{
case DataRowState.Deleted:
cmd = deleteCommandGenerator.GenerateCommand(connectionName, dbTableName, dr);
break;
case DataRowState.Modified:
cmd = updateCommandGenerator.GenerateCommand(connectionName, dbTableName, dr);
break;
case DataRowState.Added:
cmd = insertCommandGenerator.GenerateCommand(connectionName, dbTableName, dr);
break;
default:
cmd = null;
break;
}
if (cmd != null)
{
cmds.Add(cmd);
}
}
}
return cmds;
}
示例2: Update
public int Update(DataTable data)
{
int result = 0;
if (data.GetChanges() != null) {
adapter.UpdateCommand = GetUpdateCommand();
adapter.InsertCommand = GetInsertCommand();
adapter.DeleteCommand = GetDeleteCommand();
result = adapter.Update(data.GetChanges());
data.AcceptChanges();
}
return result;
}
示例3: SaveAttachedFile
/// <summary>
/// 保存附件
/// </summary>
/// <param name="storage">附件數據</param>
public void SaveAttachedFile(DataTable storage)
{
DataTable temp = storage.GetChanges(); //獲取修改的記錄
if (temp != null)//有新增或修改附件,保存數據
{
IBridge_DataDict bridge = BridgeFactory.CreateDataDictBridge(typeof(tb_sys_AttachFile));
DataSet ds = new DataSet();
ds.Tables.Add(temp);
bridge.Update(ds);
}
}
示例4: btnOK_Click
private void btnOK_Click(object sender, EventArgs e)
{
if (MenuSet.pwdSet == '0')
{
MessageBox.Show("沒有設置該權限!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
string strPwd = txtPwd.Text.Trim();
string strSel = string.Format("SELECT * FROM rhdbs.user_info WHERE user_id='{0}' AND pwd='{1}'", TheToken.LoginUser, strPwd);
DataTable dt = new DataTable();
MySqlConnection conn = new MySqlConnection(TheToken.DataConnStr);
conn.Open();
MySqlDataAdapter da = new MySqlDataAdapter(strSel, conn);
try
{
da.Fill(dt);
}
catch
{
MessageBox.Show("密碼錯誤!", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
try
{
if (txtPwdNew.Text != txtPwdNew2.Text)
{
MessageBox.Show("兩次輸入密碼不一致!", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
dt.Rows[0].BeginEdit();
dt.Rows[0]["pwd"] = txtPwdNew.Text;
dt.Rows[0].EndEdit();
MySqlCommandBuilder scb = new MySqlCommandBuilder(da);
scb.ReturnGeneratedIdentifiers = false;
da.Update(dt.GetChanges());
dt.AcceptChanges();
}
catch
{
MessageBox.Show("密碼錯誤!", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
MessageBox.Show("密碼修改成功。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
示例5: Add
public bool Add(int taskID, int userID, string message, List<DataModel.Modal.CommentAttachment> commentAttachments)
{
int retunvalue;
try
{
var datatable = new DataTable();
datatable.Columns.Add("Name", typeof(string));
datatable.Columns.Add("Path", typeof(string));
if (commentAttachments != null)
{
foreach (var commentAttachment in commentAttachments)
{
var row = datatable.NewRow();
row["Name"] = commentAttachment.FileResource.name;
row["Path"] = commentAttachment.FileResource.path;
datatable.Rows.Add(row);
}
}
using (SqlConnection con = new SqlConnection("Data Source=DESKTOP-7QFA5C9\\MSSQLSERVER_2012;Initial Catalog=SimplePlatformTemp;user id=sa;password=sa;"))
{
con.Open();
using (var command = new SqlCommand())
{
command.Connection = con;
command.CommandText = "[dbo].[sproc_SimplePlatForm_AddComment]";
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(new SqlParameter { ParameterName = "@taksID", SqlDbType = SqlDbType.Int, Value = taskID });
command.Parameters.Add(new SqlParameter { ParameterName = "@userID", SqlDbType = SqlDbType.Int, Value = userID });
command.Parameters.Add(new SqlParameter { ParameterName = "@message", SqlDbType = SqlDbType.VarChar, Value = message });
var dataTableParameter = command.Parameters.AddWithValue("@Attachments", datatable.GetChanges());
dataTableParameter.SqlDbType = SqlDbType.Structured;
dataTableParameter.TypeName = "[dbo].[Attachments]";
command.Parameters.Add(new SqlParameter { ParameterName = "@Status", SqlDbType = SqlDbType.Int, Direction = ParameterDirection.ReturnValue });
command.ExecuteNonQuery();
retunvalue = (int)command.Parameters["@Status"].Value;
}
con.Close();
}
return retunvalue == 1;
}
catch (Exception ex)
{
return false;
}
}
示例6: GetGroupAuthorityChanges
/// <summary>
/// 枚舉樹視圖,生成保存用的臨時數據。
/// 思路:枚舉樹視圖中所有樹結點,跟據樹結點的操作狀態(新增,修改)生成資料行(DataRow)
/// 新增:結點沒綁定DataRow且結點打勾. 為新增權限
/// 修改: 結點有綁定DataRow且結點沒有打勾. 為刪除權限
/// </summary>
/// <param name="auths">樹視圖綁定的權限數據</param>
/// <returns></returns>
private DataTable GetGroupAuthorityChanges(DataTable auths)
{
foreach (TreeNode node in _treeAuthority.Nodes)
{
AuthNodeTag tag = node.Tag as AuthNodeTag;
//結點沒綁定DataRow且結點打勾. 為新增權限
if (tag.DataRow == null && node.Checked)
AddAuthority(auths, node);
//結點有綁定DataRow且結點沒有打勾. 為刪除權限
else if (tag.DataRow != null && !node.Checked)
tag.DataRow.Delete();
//遞歸處理子結點
if (node.Nodes.Count > 0)
GetGroupAuthorityChangesChild(node, auths);
}
//返回修改的記錄
DataTable ret = auths.GetChanges();
return ret == null ? auths.Clone() : ret;
}
示例7: UpdateDataBase
public int UpdateDataBase(DbDataAdapter da, DataTable dt)
{
int updateCount = 0;
try
{
DataTable dtChanges = dt.GetChanges();
if (dtChanges != null && dtChanges.Rows.Count >= 0)
{
updateCount = da.Update(dtChanges);
dt.AcceptChanges();
}
}
catch (Exception)
{
dt.RejectChanges();
throw;
}
return updateCount;
}
示例8: SaveData
public Hashtable SaveData(string p_brid, string p_user, string p_terminal, ref DataTable p_dt, out string p_err)
{
#region variable Declaration
int _intNumRecords = 0, tempSrno = 0;
p_err = null;
Hashtable _htSave = new Hashtable();
_htSave.Add("TIMESTAMP", _strErrMsg);
#endregion
try
{
_base.Connect();
DataTable _dtMas = p_dt.GetChanges();
foreach (DataRow _drRow in _dtMas.Rows)
{
switch (_drRow.RowState)
{
case DataRowState.Added:
_base.BeginTransaction(IsolationLevel.ReadCommitted);
_htSave = Add(p_brid, p_user, p_terminal, _drRow);
if (_htSave["p_flg"].ToString().ToUpper() == "N")
{
_strInsertErrMsg += "Exam Id " + _drRow["SRNO"].ToString() + "";
_base.Rollback();
continue;
}
else if (_htSave["p_flg"].ToString().ToUpper() == "Y")
{
tempSrno = int.Parse(_htSave["SRNO"].ToString());
}
break;
case DataRowState.Modified:
_base.BeginTransaction(IsolationLevel.ReadCommitted);
_htSave = Update(p_brid, p_user, p_terminal, _drRow);
if (_htSave["p_flg"].ToString().ToUpper() == "T")
{
_strTimeStampErrMsg += "Srno. = " + _drRow["SRNO"].ToString() + "";
_base.Rollback();
continue;
}
else if (_htSave["p_flg"].ToString().ToUpper() == "N")
{
_strUpdateErrMsg += "Srno. = " + _drRow["SRNO"].ToString() + "";
_base.Rollback();
continue;
}
else if (_htSave["p_flg"].ToString().ToUpper() == "Y")
{
tempSrno = int.Parse(_drRow["SRNO"].ToString());
}
break;
case DataRowState.Deleted:
_base.BeginTransaction(IsolationLevel.ReadCommitted);
_htSave = Delete(p_brid, p_user, p_terminal, _drRow);
if (_htSave["p_flg"].ToString().ToUpper() == "T")
{
_strTimeStampErrMsg += "Srno. = " + _drRow["SRNO", DataRowVersion.Original].ToString() + "";
_base.Rollback();
continue;
}
else if (_htSave["p_flg"].ToString().ToUpper() == "N")
{
_strTimeStampErrMsg += "Srno. = " + _drRow["SRNO", DataRowVersion.Original].ToString() + "";
_base.Rollback();
continue;
}
break;
}
DataRow[] _drRows = null;
if (_drRow.RowState != DataRowState.Deleted)
{
_drRows = p_dt.Select("SRNO = " + _drRow["SRNO"]);
if (_drRow.RowState == DataRowState.Added)
{
p_dt.Rows[p_dt.Rows.IndexOf(_drRows[0])]["SRNO"] = tempSrno;
}
p_dt.Rows[p_dt.Rows.IndexOf(_drRows[0])]["TIME_STAMP"] = _htSave["p_time_stamp"].ToString();
}
if (_drRow.RowState == DataRowState.Deleted)
{
_drRows = p_dt.Select("SRNO =" + _drRow["SRNO", DataRowVersion.Original], "", DataViewRowState.Deleted);
}
p_dt.Rows[p_dt.Rows.IndexOf(_drRows[0])].AcceptChanges();
_intNumRecords++;
_base.Commit();
}
GetTransactionSummary(_strInsertErrMsg, _strUpdateErrMsg, _strDeleteErrMsg, _strTimeStampErrMsg, out _strErrMsg);
_htSave.Add("RESULT", "true");
_htSave["TIMESTAMP"] = _strErrMsg;
_htSave["SAVERECORD"] = _intNumRecords;
}
catch (Exception ex)
{
//.........這裏部分代碼省略.........
示例9: SetTable
public DataTable SetTable(DataTable dt)
{
try
{
DataTable dtChanges = dt.GetChanges();
if (dtChanges == null) throw new Exception("There are no changes to be saved!");
CheckPKExists(dt);
//Open and query
if (_oleConn ==null) Open();
if (_oleConn.State != ConnectionState.Open)
throw new Exception("Connection cannot open error.");
if (SetSheetQuerySelect()==false) return null;
//Fill table
OleDbDataAdapter oleAdapter = SetSheetQueryAdapter(dtChanges);
oleAdapter.Update(dtChanges);
//Clean up
_oleCmdSelect.Dispose();
_oleCmdSelect=null;
oleAdapter.Dispose();
oleAdapter=null;
if (KeepConnectionOpen==false) Close();
return dt;
}
catch (Exception ex)
{
throw ex;
}
}
示例10: Changes
public void Changes () //To test GetChanges and RejectChanges
{
DataTable table = new DataTable ();
DataColumn col = new DataColumn ();
col.ColumnName = "Id";
col.DataType = Type.GetType ("System.Int32");
table.Columns.Add (col);
UniqueConstraint uc = new UniqueConstraint ("UK1", table.Columns[0] );
table.Constraints.Add (uc);
col = new DataColumn ();
col.ColumnName = "Name";
col.DataType = Type.GetType ("System.String");
table.Columns.Add (col);
DataRow row = table.NewRow ();
row ["Id"] = 147;
row ["name"] = "Abc";
table.Rows.Add (row);
table.AcceptChanges ();
row = table.NewRow ();
row ["Id"] = 47;
row ["name"] = "Efg";
table.Rows.Add (row);
//Testing GetChanges
DataTable changesTable = table.GetChanges ();
AssertEquals ("#A01", 1 ,changesTable.Rows.Count);
AssertEquals ("#A02","Efg" ,changesTable.Rows[0]["Name"]);
table.AcceptChanges ();
changesTable = table.GetChanges ();
try {
int cnt = changesTable.Rows.Count;
}
catch(Exception e) {
if (e.GetType () != typeof (AssertionException))
AssertEquals ("#A03",typeof(NullReferenceException) ,e.GetType ());
else
Console.WriteLine (e);
}
//Testing RejectChanges
row = table.NewRow ();
row ["Id"] = 247;
row ["name"] = "Hij";
table.Rows.Add (row);
(table.Rows [0])["Name"] = "AaBbCc";
table.RejectChanges ();
AssertEquals ("#A03", "Abc" , (table.Rows [0]) ["Name"]);
AssertEquals ("#A04", 2, table.Rows.Count);
}
示例11: Main
static void Main(string[] args)
{
//Należy skonfigurować połączenie.
SqlConnection connection = new SqlConnection("Data Source=XYZ-COMP\\SQLEXPRESS; Initial Catalog=animal; Integrated Security=true;");
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = new SqlCommand("SELECT * FROM Zwierz", connection);
da.InsertCommand = new SqlCommand("INSERT INTO Zwierz (ID, Nazwa_pl, Nazwa_ang) VALUES(@ID, @Nazwa_pl, @Nazwa_ang)", connection);
da.UpdateCommand = new SqlCommand("UPDATE Zwierz SET [email protected], [email protected]_pl, [email protected]_ang WHERE [email protected]_prev", connection);
da.DeleteCommand = new SqlCommand("DELETE FROM Zwierz WHERE [email protected]", connection);
da.InsertCommand.Parameters.Add("@ID", SqlDbType.Int, 0, "ID").SourceVersion = DataRowVersion.Original;
da.InsertCommand.Parameters.Add("@Nazwa_pl", SqlDbType.VarChar, 30, "Nazwa_pl").SourceVersion = DataRowVersion.Original;
da.InsertCommand.Parameters.Add("@Nazwa_ang", SqlDbType.VarChar, 30, "Nazwa_ang").SourceVersion = DataRowVersion.Original;
da.UpdateCommand.Parameters.Add("@ID", SqlDbType.Int, 0, "ID").SourceVersion = DataRowVersion.Current;
da.UpdateCommand.Parameters.Add("@Nazwa_pl", SqlDbType.VarChar, 30, "Nazwa_pl").SourceVersion = DataRowVersion.Current;
da.UpdateCommand.Parameters.Add("@Nazwa_ang", SqlDbType.VarChar, 50, "Nazwa_ang").SourceVersion = DataRowVersion.Current;
da.UpdateCommand.Parameters.Add("@ID_Prev", SqlDbType.Int, 0, "ID").SourceVersion = DataRowVersion.Original;
da.DeleteCommand.Parameters.Add("@ID", SqlDbType.Int, 0, "ID").SourceVersion = DataRowVersion.Current;
DataTable dt = new DataTable("Zwierz");
da.Fill(dt);
//var start--------------
int ID;
String Nazwa_pl, Nazwa_ang;
String wybor; //opcja uzytkownika
int indeks; //indeks wiersza do usuniecia
DataRowCollection itemColumns = dt.Rows;
DataTable dtChanges = dt.GetChanges();
//var end-----------------
while (true) //dopoki uzytkownik nie zakonczy programu
{
Console.WriteLine("Wybierz 1 - dodaj zwierza");
Console.WriteLine("Wybierz 2 - usun zwierza");
Console.WriteLine("Wybierz 3 - modyfikuj zwierza");
Console.WriteLine("Wybierz 4 - listuj");
Console.WriteLine("Wybierz 5 - zakoncz");
wybor = Console.ReadLine(); //pobranie opcji
if (wybor.Equals("1"))
{
Console.WriteLine("Podaj w kolejnych 3 wierszach wartosci: ID, Nazwa_pl, Nazwa_ang");
ID = Convert.ToInt32(Console.ReadLine());
Nazwa_pl = Console.ReadLine();
Nazwa_ang = Console.ReadLine();
DataRow newRow = dt.NewRow();
newRow["ID"] = ID;
newRow["Nazwa_pl"] = Nazwa_pl;
newRow["Nazwa_ang"] = Nazwa_ang;
dt.Rows.Add(newRow);
dtChanges = dt.GetChanges();
if (dtChanges != null)
{
da.Update(dtChanges);
dt.AcceptChanges();
}
}
else if (wybor.Equals("2"))
{
Console.WriteLine("Podaj numer wiersza tabeli, ktory chcesz usunac (numerujac wiersze od zera):");
indeks = Convert.ToInt32(Console.ReadLine());
itemColumns[indeks].Delete();
dtChanges = dt.GetChanges();
if (dtChanges != null)
{
da.Update(dtChanges);
dt.AcceptChanges();
}
}
else if (wybor.Equals("3"))
{
Console.WriteLine("Podaj numer wiersza tabeli, ktory chcesz zmodyfikowac (numerujac wiersze od zera):");
indeks = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Podaj w kolejnych 3 wierszach nowe wartosci: ID, Nazwa_pl, Nazwa_ang");
ID = Convert.ToInt32(Console.ReadLine());
Nazwa_pl = Console.ReadLine();
Nazwa_ang = Console.ReadLine();
itemColumns[indeks]["ID"] = ID;
itemColumns[indeks]["Nazwa_pl"] = Nazwa_pl;
itemColumns[indeks]["Nazwa_ang"] = Nazwa_ang;
dtChanges = dt.GetChanges();
if (dtChanges != null)
{
da.Update(dtChanges);
dt.AcceptChanges();
//.........這裏部分代碼省略.........
示例12: Save
/// <summary>
/// Saves the table to the DB.
/// </summary>
/// <param name="table">database table.</param>
public void Save(DataTable table)
{
try
{
// prepares select command.
string query = "SELECT * FROM " + table.TableName;
command.CommandType = CommandType.Text;
command.CommandText = query;
command.Connection = connection;
// opens connection.
connection.Open();
// gets transaction context.
SqlTransaction transaction = connection.BeginTransaction(IsolationLevel.RepeatableRead);
command.Transaction = transaction;
// sets the SqlCommandBuilder that constructs update, delete, insert commands.
SqlDataAdapter dataAdapter = new SqlDataAdapter();
dataAdapter.SelectCommand = command;
SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);
try
{
DataTable changes;
changes = table.GetChanges(DataRowState.Deleted);
if(changes != null)
dataAdapter.Update(changes);
changes = table.GetChanges(DataRowState.Modified);
if(changes != null)
dataAdapter.Update(changes);
changes = table.GetChanges(DataRowState.Added);
if(changes != null)
dataAdapter.Update(changes);
transaction.Commit();
}
catch
{
transaction.Rollback();
throw;
}
}
catch(Exception e)
{
Log.WriteErrorToLog(e.Message);
throw;
}
}
示例13: UpdateData
private void UpdateData(DataTable table)
{
DataTable deleted = table.GetChanges(DataRowState.Unchanged);
if (deleted != null)
{
DataColumn[] columns = table.PrimaryKey;
if (columns != null && columns.Length != 0)
{
foreach (DataRow row in deleted.Rows)
{
object[] keys = GetPrimaryKeyValue(row, columns);
DataRow found = table.Rows.Find(keys);
if (found != null)
table.Rows.Remove(found);
}
}
}
table.AcceptChanges();
}
示例14: MergeChanges
/// <summary>
/// Merge all changes in DataTable sourceData to the imported DataSet
/// </summary>
/// <param name="sourceData">DataTable that contains changes</param>
public void MergeChanges(DataTable sourceData)
{
string connection_string;
string query;
DataTable DestinationDataTable = new DataTable();
query = "SELECT * FROM (" + sourceData.TableName + ");";
connection_string = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + dbpath + ";";
OleDbConnection Connection = new OleDbConnection(connection_string);
OleDbDataAdapter accessOleAdapter = new OleDbDataAdapter(query, Connection);
OleDbCommandBuilder myCB = new OleDbCommandBuilder(accessOleAdapter);
Connection.Open();
accessOleAdapter.Fill(DestinationDataTable);
DestinationDataTable.TableName = sourceData.TableName;
DestinationDataTable.Merge(sourceData, true, MissingSchemaAction.Ignore);
try
{
accessOleAdapter.Update(DestinationDataTable.GetChanges());
DestinationDataTable.AcceptChanges();
sourceData.AcceptChanges();
}
catch (Exception E)
{
MessageBox.Show(E.Message);
}
Connection.Close();
}
示例15: SaveData
public Hashtable SaveData(ref DataTable p_dtParameter)
{
int _intNumRecords = 0;
string _strCriteria = "";
Hashtable _htSave = new Hashtable();
string _strTimeStampErrMsg = "Timestamp Error : \n";
string _strInsertErrMsg = "Problem In Inserting Record : \n";
string _strUpdateErrMsg = "Problem In Updating Record : \n";
string _strDeleteErrMsg = "Record can't deleted due to child record exist : \n";
string _strErrMsg = "";
_htSave.Add("TIMESTAMP", _strErrMsg);
try
{
wrap.GetConnection();
DataTable _dtTemp = p_dtParameter.GetChanges();
DataRow[] _drRows;
_strCriteria = "";
foreach (DataRow _drRow in _dtTemp.Rows)
{
if (_drRow.RowState != DataRowState.Deleted)
{
bool _isCheckDuplicate = true;
if (_drRow.RowState == DataRowState.Modified)
{
if ((GetValueOfObject(_drRow["SHIFT_NAME", DataRowVersion.Current])) == (GetValueOfObject(_drRow["SHIFT_NAME", DataRowVersion.Original])))
{
_isCheckDuplicate = false;
}
if (_isCheckDuplicate)
{
if (CheckExistUserName(_drRow["UserName", DataRowVersion.Original].ToString(),_drRow["Password",DataRowVersion.Original].ToString(),"Other") == 'Y')
{
_htSave.Add("RESULT", "true");
}
}
}//if(modified)
}
switch (_drRow.RowState)
{
case DataRowState.Added:
_htSave = AddData(_drRow);
_strCriteria = FetchCriteria(_drRow, DataRowVersion.Current, out p_err);
_drRows = p_dtParameter.Select(_strCriteria);
if (_drRows.Length > 0)
{
if (_drRow.RowState == DataRowState.Added)
{
p_dtParameter.Rows[p_dtParameter.Rows.IndexOf(_drRows[0])]["SHIFT_ID"] = _htSave["p_shift_id"].ToString();
}
p_dtParameter.Rows[p_dtParameter.Rows.IndexOf(_drRows[0])]["TIME_STAMP"] = _htSave["p_time_stamp"].ToString();
}
if (_htSave["p_flg"].ToString().ToUpper() == "N")
_strInsertErrMsg += "Shift Name = " + _drRow["SHIFT_NAME"] + "\n";
break;
case DataRowState.Modified:
_htSave = UpdateData(p_entTerm, p_entUser, _drRow, out p_err);
if (_htSave["p_flg"].ToString().ToUpper() == "T")
{
_strTimeStampErrMsg += "Shift Name = " + _drRow["SHIFT_NAME"] + "\n";
continue;
}
if (_htSave["p_flg"].ToString().ToUpper() == "N")
_strUpdateErrMsg += "Shift Name = " + _drRow["SHIFT_NAME"] + "\n";
break;
case DataRowState.Deleted:
_htSave = DeleteData(p_entUser, p_entTerm, _drRow, out p_err);
_strCriteria = FetchCriteria(_drRow, DataRowVersion.Original, out p_err);
_drRows = p_dtParameter.Select(_strCriteria);
if (_drRows.Length > 0)
{
if (_drRow.RowState == DataRowState.Deleted)
{
p_dtParameter.Rows[p_dtParameter.Rows.IndexOf(_drRows[0])]["SHIFT_ID"] = _htSave["p_shift_id"].ToString();
}
p_dtParameter.Rows[p_dtParameter.Rows.IndexOf(_drRows[0])]["TIME_STAMP"] = _htSave["p_time_stamp"].ToString();
}
if (_htSave["p_flg"].ToString().ToUpper() == "T")
{
_strTimeStampErrMsg += "Shift Name = " + _drRow["SHIFT_NAME", DataRowVersion.Original] + "\n";
continue;
}
if (_htSave["p_flg"].ToString().ToUpper() == "N")
_strDeleteErrMsg += "Shift = " + _drRow["SHIFT_NAME", DataRowVersion.Original] + "\n";
break;
//.........這裏部分代碼省略.........