what's wrong with this parameter?

A

André

Hi,

I made a detailsview for inserting data in the table.
I also made a dropdownlist which the selected value must be used for one of
the field in the detailsview.
In the <InsertParameters> tag, i removed the parameter 'lo' because i added
it from code-behind.
I put the 'DataKeyNames' as the primary key of the table in detailsview.

My problem is:
"No value given for one or more required parameters"

In aspx, i did:
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConflictDetection="CompareAllValues"
ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\mytable.mdb"
....
InsertCommand="INSERT INTO [pc] ([na], [deft], [lo]) VALUES (?, ?, @lo)"
OldValuesParameterFormatString="original_{0}"
ProviderName="System.Data.OleDb"
<InsertParameters>
<asp:parameter Name="na" Type="String" />
<asp:parameter Name="deft" Type="Boolean" />
</InsertParameters>

If i add this, it works (but still with this value)
<asp:parameter Name="anything" DefaultValue="1-45" Type="String" />

code-behind:
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
Dim lo As String
lo = DropDownList1.SelectedValue
SqlDataSource1.InsertParameters.Add("lo", lo)
End Sub


What did i not see?
Thanks for help
André
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,813
Messages
2,569,696
Members
45,483
Latest member
TedDvb6626

Latest Threads

Top