|
|
|
Delete ข้อมูลใน Gridview ในแต่ละ Row เเต่ขึ้น Error |
|
|
|
|
|
|
|
สอบถามข้อมูลหน่อยค่ะ พอดีเพิ่งมาเตะ C#
ต้องการลบข้อมูลใน Gridview ในเเต่ละ Row โดยที่นำลิ้งไปวางไว้ใน Gridview เเต่ขึ้น Error เเบบนี้อะคะ
ข้อมูลที่ต้องการลบ
Code (C#)
protected void GridView8_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
string fileid = GridViewTool.getCellText((GridView)sender, e.RowIndex, "FILEID");
string datetime = GridViewTool.getCellText((GridView)sender, e.RowIndex, "DATETIME");
IDBHandler _THDBConn = null;
try
{
//_THDBConn = DBHandleBuilder.GetConnection(Constant.DB_NID, _logger);
_THDBConn = DBHandleBuilder.GetConnection(Constant.DB_BOONG, _logger);
FileDamage_DAO orderDao = new FileDamage_DAO(_logger);
orderDao.GetDelete(_THDBConn, fileid,datetime);
//showStartUpMessage("ShowDelete", "OrderNo" + orderNo + " is Delete data Success.");
SetgvBarcode(_THDBConn);
}
catch (Exception ex)
{
showStartUpMessage("RemoveErpOrderInfo", "Error happened:" + ex.ToString());
}
finally
{
if (_THDBConn != null)
{
_THDBConn.Dispose();
}
}
//GridView8.DataSource = dt;
//GridView8.DataBind();
//ShowDataAl();
}
private void SetgvBarcode(IDBHandler conn)
{
FileDamage_DAO dao = new FileDamage_DAO(_logger);
//List<ErpOrderInfoVO> erpOrderList = dao.queryErpOrderList(conn, "%" + txtOrderNo.Text + "%", ddlProductID.SelectedValue, true);
DataTable dt = new DataTable();
dt.Columns.Add("FILEID");
//dt.Columns.Add("DATETIME");
this.GridView8.DataSource = null;
this.GridView8.DataBind();
}
private void showStartUpMessage(string key, string msg)
{
string scriptMsg = msg.Replace("\\", "\\\\").Replace("'", "\\'").Replace("\r", "").Replace("\n", "\\n");
Page.ClientScript.RegisterStartupScript(Page.GetType(), key, "alert('" + scriptMsg + "');", true);
}
data
Code (C#)
public int GetDelete(IDBHandler conn, string fileid, string datetime)
{
//DataTable dtTmp = new DataTable();
//StringBuilder sb = null;
_logger.Info(" deleteBarcodeInfo() - Start ");
try
{
//sb = new StringBuilder();
string sql = " DELETE FROM VDATA D, VCTRL C "
+ " WHERE C.fileid = '" + fileid + "'"
+ " AND D.vctrlid = C.vctrlid "
+ " AND datetime = TO_DATE('" + datetime + "', 'MM/DD/YYYY HH24:MI:SS') ";
int deleteCnt = conn.ExecuteNonQuery(sql, false);
_logger.Info(" deleteBarcodeInfo() - End ");
return deleteCnt;
}
catch (Exception ex)
{
_logger.Info(ex);
throw ex;
}
}
Tag : Oracle, C#
|
|
|
|
|
|
Date :
2019-06-18 09:18:05 |
By :
PBee |
View :
693 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|