public void SaveEdits()
{
string SQL = "UPDATE SURVEY_CAMPAIGN SET OUTGOING_VDN =" + txtOutgoing.Value + "AND LANG_CD =" + txtlang.Value + "AND ANNOUNCEMENT_FOLDER =" + txtAnnouc.Value + "AND EXCEEDED_AUDIO =" + txtExceed.Value + "AND VALID_ENTRY_AUDIO =" + txtExit.Value +
" WHERE CAMPAIGN_ID =" + CampignsDRP.SelectedValue;
try
{
using (OracleConnection conn = SingleConnection.Instance.ActiveConn)
{
conn.Open();
OracleCommand cmd = conn.CreateCommand();
OracleDataAdapter dataAdapter = new OracleDataAdapter(SQL, conn);
System.Data.DataSet db = new System.Data.DataSet();
cmd.CommandType = CommandType.Text;
cmd.CommandText = SQL;
int result = cmd.ExecuteNonQuery();
dataAdapter.Fill(db, "Campaign");
cmd.Dispose();
conn.Close();
}
ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "UpdateCompleted()", true);
}
catch (Exception ex)
{
string error = ex.Message;
ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "ShowError('" + error + "')", true);
LogUtil.Debug("Page Campaign Update Exception Occured " + ex.Message);
}
}
答案 0 :(得分:0)
string SQL = "UPDATE SURVEY_CAMPAIGN SET OUTGOING_VDN = @OUTGOING_VDN, LANG_CD = @LANG_CD, ANNOUNCEMENT_FOLDER = @ANNOUNCEMENT_FOLDER, EXCEEDED_AUDIO = @EXCEEDED_AUDIO, VALID_ENTRY_AUDIO = @VALID_ENTRY_AUDIO WHERE CAMPAIGN_ID = @CAMPAIGN_ID" ;
//Now put this parameters before int result = cmd.ExecuteNonQuery();
cmd.Parameters.AddWithValue("@OUTGOING_VDN", txtOutgoing.Text);
cmd.Parameters.AddWithValue("@LANG_CD", txtlang.Text);
cmd.Parameters.AddWithValue("@ANNOUNCEMENT_FOLDER",
txtAnnouc.Text);
cmd.Parameters.AddWithValue("@EXCEEDED_AUDIO", txtExceed.Text);
cmd.Parameters.AddWithValue("@VALID_ENTRY_AUDIO", txtExit.Text);
cmd.Parameters.AddWithValue("@CAMPAIGN_ID", CampignsDRP.SelectedValue);