PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET problem with passing parameter

Reply

problem with passing parameter

 
Thread Tools Rate Thread
Old 23-06-2006, 01:39 PM   #1
André
Guest
 
Posts: n/a
Default problem with passing parameter


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é


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off