J
Jim McGivney
I have a button on an aspx page. When the user clicks the button I would
like to add a new row to an existing table in my Access database. The table
is Ante_Admin. The name of the key field is AnteNum, I would like to set
the value of AnteNum to MyVal.
In code behind on an aspx page I have:
protected void Button1_Click1(object sender, EventArgs e)
{
string MyVal = "2";
AccessDataSource AccessDataSource2 = new AccessDataSource();
AccessDataSource2.DataFile =
System.Configuration.ConfigurationManager.AppSettings["ConnString"];
Parameter Param = new Parameter("AnteNum");
Param.DefaultValue = MyVal;
AccessDataSource2.SelectParameters.Add(Param);
AccessDataSource2.InsertCommand = "INSERT INTO Ante_Admin (AnteNum) VALUES
(@Param)";
AccessDataSource2.Insert();
}
When the button is pressed, I get the following error message: No value
given for one or more required parameters.
This probably exhibits my lack of understanding of Parameters. I am not
able to set the value of Param to MyVal. Any suggestions including sample
code would be appreciated.
Jim
like to add a new row to an existing table in my Access database. The table
is Ante_Admin. The name of the key field is AnteNum, I would like to set
the value of AnteNum to MyVal.
In code behind on an aspx page I have:
protected void Button1_Click1(object sender, EventArgs e)
{
string MyVal = "2";
AccessDataSource AccessDataSource2 = new AccessDataSource();
AccessDataSource2.DataFile =
System.Configuration.ConfigurationManager.AppSettings["ConnString"];
Parameter Param = new Parameter("AnteNum");
Param.DefaultValue = MyVal;
AccessDataSource2.SelectParameters.Add(Param);
AccessDataSource2.InsertCommand = "INSERT INTO Ante_Admin (AnteNum) VALUES
(@Param)";
AccessDataSource2.Insert();
}
When the button is pressed, I get the following error message: No value
given for one or more required parameters.
This probably exhibits my lack of understanding of Parameters. I am not
able to set the value of Param to MyVal. Any suggestions including sample
code would be appreciated.
Jim