what's wrong with this parameter?

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

  1. André

    André Guest

    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é
    André, Jun 24, 2006
    #1
    1. Advertising

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.
Similar Threads
  1. Replies:
    4
    Views:
    508
    Matteo
    Mar 29, 2007
  2. Stuart Redmann
    Replies:
    5
    Views:
    469
    Stuart Redmann
    Dec 14, 2007
  3. Replies:
    5
    Views:
    622
  4. Isti
    Replies:
    2
    Views:
    700
  5. Mister B
    Replies:
    8
    Views:
    531
    Nick Keighley
    Aug 26, 2010
Loading...

Share This Page