I am trying to build a C#.net program that works like a RPG Subfile on the AS400.
Have the general subfile part working. I can display and then edit and update existing records.
Am blowing up in my code where I am trying to insert a new record. Blowing up on the
cmd.ExecuteNonQuery();
If you want to see how this works without the insert go to
Look at the Website1a
Here is the code.
using IBM.Data.DB2.iSeries;
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class WebForm3 : System.Web.UI.Page
{
protected void btnBack_Click(object sender, EventArgs e)
{
Server.Transfer("WebForm1a.aspx");
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
ConnectionStringSettingsCollection cssc =
ConfigurationManager.ConnectionStrings;
String connString = cssc["FTWAS400"].ToString();
iDB2Connection conn = new iDB2Connection(connString);
conn.Open();
iDB2Command cmd = new iDB2Command(
"insert into tburrows.qcustcdt (cusnum, init, lstnam, street, city, state, zipcod, cdtlmt, chgcod, baldue, cdtdue) values (@cusnum, @init, @lstnam, @street, @city, @state, @zipcod, @cdtlmt, @chgcod, @baldue, @cdtdue)", conn);
cmd.DeriveParameters();
cmd.Parameters["@cusnum"].Value = Request["txtCUSNUM"];
cmd.Parameters["@init" ].Value = Request["txtINIT"];
cmd.Parameters["@lstnam"].Value = Request["txtLSTNAM"];
cmd.Parameters["@street"].Value = Request["txtSTREET"];
cmd.Parameters["@city"].Value = Request["txtCITY"];
cmd.Parameters["@state"].Value = Request["txtSTATE"];
cmd.Parameters["@zipcod"].Value = Request["txtZIPCOD"];
cmd.Parameters["@cdtlmt"].Value = Request["txtCDTLMT"];
cmd.Parameters["@chgcod"].Value = Request["txtCHGCOD"];
cmd.Parameters["@baldue"].Value = Request["txtBALDUE"];
cmd.Parameters["@cdtdue"].Value = Request["txtCDTDUE"];
cmd.ExecuteNonQuery();
cmd.Dispose();
conn.Close();
btnBack_Click(sender, e);
}
}
Any help will greatly be appreciated.
Thomas