Hi,
I am trying to add records to an MS Access database, when I hit the save key I get the above error.
Works fine for viewing and editing existing records, the ID column of teh Access database is set to AutoNumber (Long Integer), I have specifically assigned either null vqlues or empty string values to fields where there is no value input by the end user but I still get the above error.
Any ideas???
<code>
protected void btnSave_Click(object sender, EventArgs e)
{
ReviewFields rvF = new ReviewFields();
int Flag = 0;
if (txtPbm.Text == "")
Flag = 1;
if (ddlCComp.SelectedIndex == 0)
Flag += 1;
if (txtServer.Text == "")
Flag += 1;
if (ddlStatus.SelectedIndex == 0)
Flag += 1;
if (Flag == 0)
{
// Save/Update record
if (hdRecID.Value != "")
rvF.LoadByPrimaryKey(
Convert.ToInt32(hdRecID.Value));
else
{
rvF.AddNew();
rvF.Problem =
Convert.ToInt32(txtPbm.Text);
}
rvF.CAMSCompany =
Convert.ToInt32(ddlCComp.SelectedItem.Value);
rvF.ServerName = txtServer.Text;
rvF.StartDate = rdpSDate.SelectedDate;
rvF.Status =
Convert.ToInt32(ddlStatus.SelectedItem.Value);
rvF.Description = txtDescription.Text;
rvF.Classification = ddlClass.SelectedItem.Text;
rvF.Sdm = rdpSDM.SelectedDate;
rvF.Client = rdpClient.SelectedDate;
rvF.Review = rdpRDate.SelectedDate;
rvF.Sla = rdpSLA.SelectedDate;
rvF.Capacity = ddlCap.SelectedItem.Text;
if (ddlMon.SelectedIndex > 0)
rvF.MonLog = ddlMon.SelectedItem.Text;
else
rvF.MonLog =
null;
if (rtbICount.Text != "")
rvF.Incident =
Convert.ToInt32(rtbICount.Text);
else
rvF.Incident = 1;
if (ddlAction.SelectedIndex > 0)
rvF.Action =
Convert.ToInt32(ddlAction.SelectedItem.Value);
else
rvF.Action =
null;
rvF.Owner = txtOwner.Text;
rvF.Cause = txtCause.Text;
rvF.Recommendations = txtRec.Text;
rvF.Notes = txtNotes.Text;
rvF.Save();
RadAjaxPanel1.ResponseScripts.Add(
string.Format("btnClose();"));
}
else
{
//Disply Error: Required Fields not complete
RadAjaxPanel1.ResponseScripts.Add(
string.Format("alert('All required fields have not been filled in!!');"));
}
}
<end code>
Regards..
Peter