473,498 Members | 1,704 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

is there really nobody who can solve this?

Hi,

I have still this unsolved problem, so i post it again.
I hope someone replies and solves this or tells me it's impossible to do
that this way ...
My feeling is that it must work ...

I have a detailsview for inserting data, and a dropdownlist which
selectedValue must be used to fill one of the field of the detailsview.
Table 'pc' is related to table 'lok'.

I tried a lot of things, but still without succes. Here are the two methods
i tried with two different errors. It works only when i introduce directly a
value in "DefaultValue" (see below)

Thanks for help
André
1) first method:
asp:SqlDataSource ID="SqlDataSource1" runat="server" ....
....
InsertCommand="INSERT INTO [pc] ([na], [ty], [lok]) VALUES (?, ?, @lok)"
OldValuesParameterFormatString="original_{0}"
ProviderName="System.Data.OleDb"
<InsertParameters>
<asp:Parameter Name="na" Type="String" />
<asp:Parameter Name="ty" Type="String" />
</InsertParameters>
.....
Code-behind:
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
lok = DropDownList1.SelectedValue
SqlDataSource1.InsertParameters.Add("lok", lokl)
End Sub

This gives: No value given for one or more required parameters
----------------------------------------------------------------------------
-------------------------
2) second method
asp:SqlDataSource ID="SqlDataSource1" runat="server" ....
....
InsertCommand="INSERT INTO [pc] ([na], [ty], [lok]) VALUES (?, ?, @lok)"
OldValuesParameterFormatString="original_{0}"
ProviderName="System.Data.OleDb"
<InsertParameters>
<asp:Parameter Name="na" Type="String" />
<asp:Parameter Name="ty" Type="String" />
<asp:Parameter Name="lok" Type="String" DefaultValue="<%=lok %>" />
</InsertParameters>
....

Code-behind:
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
lok = DropDownList1.SelectedValue
End Sub

This gives: You cannot add or change a record because a related record is
required in table 'lokl'
which means in fact that the value of the parameter is not passed!

It works when i give directly a value: <asp:Parameter Name="lok"
Type="String" DefaultValue="1-45" />
Jun 27 '06 #1
0 922

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

Similar topics

1
2438
by: Sullivan | last post by:
When I run a CGI script (Python) with Python's CGIHTTPServer, it should run with the UID of the user 'nobody' (as the documentation says). But if I let the CGI script e.g. create a file, it...
26
1771
by: DeMarcus | last post by:
Let's say we're gonna make a system library and have a class with two prerequisites. * It will be used _a_lot_, and therefore need to be really efficient. * It can have two different...
8
3220
by: Mike Thomas | last post by:
I have two clients now who want to have an Access 2000 & 2002 application running on NT Server 2000 do some file updating at night when nobody is in the office. I have used Windows scheduler to...
38
3271
by: Martin Marcher | last post by:
Hi, I've read several questions and often the answer was 'C knows nothing about .' So if C knows that little as some people say, what are the benefits, I mean do other languages know more...
10
3876
by: gcmf8888 | last post by:
How to freeze column in datagrid like Excel? Thanks.
0
833
by: G Dean Blake | last post by:
This datagrid (dgbudgets) binds perfectly and column4 is a non visible column. Immediately after the bind, however, column(4).visible is true both in the grid and the grid retrieved from the...
131
6008
by: pemo | last post by:
Is C really portable? And, apologies, but this is possibly a little OT? In c.l.c we often see 'not portable' comments, but I wonder just how portable C apps really are. I don't write...
4
3881
by: Jason | last post by:
I'm troubleshooting a program that I didn't build, so forgive me on this one. It's called email.php, and it looks like a program that the original developer must have downloaded from somewhere. ...
4
2682
by: Fro | last post by:
Hi, the operating system (Unix) considers a php-server as a user with name "nobody". For example, if my php-script saves a file uploaded by a user, the owner of the file will be "nobody". I...
0
7125
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
7165
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6887
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
5462
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,...
1
4910
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...
0
4590
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1419
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
291
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.