473,409 Members | 1,945 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

Parameter value

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.AppSetti ngs["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
Apr 13 '06 #1
2 1791
Try replaceing @Param with (?) in the Insert command you are
passing......

I am sure it will work.

Apr 13 '06 #2
> 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.AppSetti ngs["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


This is also a standard Access way of saying "I don't know that column
you specified". Does "AnteNum" really exist (typo somewhere?)

Hans Kesting
Apr 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dan | last post by:
I've run into an interesting problem, and seemed to have stumped 3 newsgroups and 2 other forums. For some reason when I try to insert a record into a SQL table that has a Text column, the...
2
by: J Krugman | last post by:
I have a form with a couple of submit buttons, plus a "pseudolink" that is also supposed to submit the form; the submitted form data feeds to a CGI script. The two submit buttons have the name...
2
by: systemutvecklare | last post by:
Hi! I have an application that generates an html-form from an xml-file using an xsl-file. My problem is that I want the xsl to use some "unknown" parameters that I pass to the xslt processor...
2
by: PK | last post by:
Hi, I have an application that opens a Crystal report document and passes in a value to a parameter in the report (pointing to an Oracle DB). However, if I want to pass a "null" value to retrieve...
1
by: | last post by:
Hi, I've defined an ObjectDataSource and a parameterized DataSet. I would like it if I could pass the parameter value that describes the query that creates the DataSet as part of a user control...
7
by: Richard Grant | last post by:
Hi. In c/C++ i can pass the address of a subroutine to another subroutine as an actual parameter How do I do that in VB .NET What should be the syntax for a parameter to receive the address of a...
3
by: Robert | last post by:
What is the best way to pass a parameter to an ObjectDataSource. I am able to add a new parameter to the SelectParameters, but I would like to just assign a value to an existing parmeter at...
4
by: Ranginald | last post by:
Hi, I'm having trouble passing a parameter from my default.aspx page to my default2.aspx page. I have values from a query in a list box and the goal is to pass the "catID" from default.aspx...
16
by: hzmonte | last post by:
Correct me if I am wrong, declaring formal parameters of functions as const, if they should not be/is not changed, has 2 benefits; 1. It tells the program that calls this function that the...
1
by: John Bailo | last post by:
This is a my solution to getting an Output parameter from a SqlDataSource. I have seen a few scant articles but none of them take it all the way to a solution. Hopefully this will help some...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.