using System; using System.Data; using System.Data.SqlClient; using System.Data.SQLite; using System.Windows.Forms; namespace IOM_cs.irisDb.service.sqliteImpl { public class IrisDataCollService_SqliteImpl:IIrisDataCollService { /// <summary> /// 保存编辑 /// </summary> public int UpdateColldata(long irid, String uploadCode, String upLoadUser, String resUpload) { int iRetval = 0; try { DateTime dt = DateTime.Now; // sys_person表 string sQry = "UPDATE iris_data_coll set " + "FLG_UPLOAD=@v1," + "UPLOAD_USER=@v2," + "UPLOAD_TIME=@v3, " + "RES_UPLOAD=@v4 " + "WHERE ir_id=@v5"; SQLiteCommand aCommand = new SQLiteCommand(sQry, _SqliteHelper.sqliteConnection); aCommand.CommandTimeout = 0; aCommand.Parameters.AddWithValue("@v1", uploadCode); aCommand.Parameters.AddWithValue("@v2", upLoadUser); aCommand.Parameters.AddWithValue("@v3", dt); aCommand.Parameters.AddWithValue("@v4", resUpload); aCommand.Parameters.AddWithValue("@v5", irid); aCommand.Parameters.Add(new SQLiteParameter("@v1", DbType.String)); aCommand.Parameters.Add(new SQLiteParameter("@v2", DbType.String)); aCommand.Parameters.Add(new SQLiteParameter("@v3", DbType.DateTime)); aCommand.Parameters.Add(new SQLiteParameter("@v4", DbType.String)); aCommand.Parameters.Add(new SQLiteParameter("@v5", DbType.String)); aCommand.Parameters[0].Value = uploadCode; aCommand.Parameters[1].Value = upLoadUser; aCommand.Parameters[2].Value = dt; aCommand.Parameters[3].Value = resUpload; aCommand.Parameters[4].Value = irid; aCommand.ExecuteNonQuery(); aCommand.Dispose(); } catch (SqlException exSqlDb) { iRetval = exSqlDb.ErrorCode; if (_SqliteHelper.sqliteConnection.State == ConnectionState.Closed) { MessageBox.Show("数据库连接断开,请重启软件!"); return -1; } MessageBox.Show("Update EXCEPTION: " + exSqlDb.Message); } catch (Exception ex) { MessageBox.Show("Update EXCEPTION: " + ex.Message); } return iRetval; } } }