I have been working on the new project and I have met this situation where I couldn't come out of it. The code is to insert data into DB.
ASPX file code: {
<InsertParameters>
<asp:Parameter Name="MilestoneName" Type="String" />
<asp:Parameter Name="JobCodeID" Type="Int32" />
<asp:Parameter Name="IsBODApplicable" Type="Boolean" />
<asp:Parameter Name="JobCode" Type="String" />
<asp:Parameter Name="SeqNo" Type="Int32" />
<asp:Parameter Direction="InputOutput" Name="ErrNo" Type="Object" />
</InsertParameters>
}
cs File code:
{
odsMilestones.InsertParameters.Clear();
odsMilestones.InsertParameters.Add("MilestoneName", tbMilestoneName.Text);
odsMilestones.InsertParameters.Add("JobCodeID", "0");
odsMilestones.InsertParameters.Add("IsBODApplicable", chkBODApplicable.Checked.ToString());
odsMilestones.InsertParameters.Add("JobCode", ddlToBeCompleted.SelectedValue);
odsMilestones.InsertParameters.Add("SeqNo", tbSeqNo.Text);
odsMilestones.InsertParameters.Add("ErrNo", null);
odsMilestones.Insert();
grvMilestones.DataBind();
}
Dataset Designer Code: {
public virtual object uSP_Milestone_Insert(string MilestoneName, global::System.Nullable<int> JobCodeID, global::System.Nullable<bool> IsBODApplicable, string JobCode, global::System.Nullable<int> SeqNo, ref global::System.Nullable<int> ErrNo) {
global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[2];
if ((MilestoneName == null)) {
command.Parameters[1].Value = global::System.DBNull.Value;
}
else {
command.Parameters[1].Value = ((string)(MilestoneName));
}
if ((JobCodeID.HasValue == true)) {
command.Parameters[2].Value = ((int)(JobCodeID.Value));
}
else {
command.Parameters[2].Value = global::System.DBNull.Value;
}
if ((IsBODApplicable.HasValue == true)) {
command.Parameters[3].Value = ((bool)(IsBODApplicable.Value));
}
else {
command.Parameters[3].Value = global::System.DBNull.Value;
}
if ((JobCode == null)) {
command.Parameters[4].Value = global::System.DBNull.Value;
}
else {
command.Parameters[4].Value = ((string)(JobCode));
}
if ((SeqNo.HasValue == true)) {
command.Parameters[5].Value = ((int)(SeqNo.Value));
}
else {
command.Parameters[5].Value = global::System.DBNull.Value;
}
if ((ErrNo.HasValue == true)) {
command.Parameters[6].Value = ((int)(ErrNo.Value));
}
else {
command.Parameters[6].Value = global::System.DBNull.Value;
}
}
I have debugged and tried to find the error. I couldn't. Please help.