Home All Groups Group Topic Archive Search About

problem with passing parameter

Author
23 Jun 2006 12:39 PM
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é

AddThis Social Bookmark Button