what's wrong with this parameter?

Discussion in 'ASP .Net' started by André, Jun 24, 2006.

  1. André

    André Guest


    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"
    InsertCommand="INSERT INTO [pc] ([na], [deft], [lo]) VALUES (?, ?, @lo)"
    <asp:parameter Name="na" Type="String" />
    <asp:parameter Name="deft" Type="Boolean" />

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

    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é, Jun 24, 2006
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.