Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 23rd, 2006, 10:00 AM
Friend of Wrox
Join Date: Apr 2006
Posts: 160
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem with passing parameter


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"
ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0 ;Data
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
passing parameter sarah lee ASP.NET 1.0 and 1.1 Basics 3 September 5th, 2006 04:29 PM
Problem in passing parameter to xslt template uttamgarg XSLT 0 April 20th, 2006 09:53 AM
passing parameter.. suzila VB.NET 2002/2003 Basics 7 May 17th, 2004 08:28 PM
Parameter passing psambor Beginning PHP 0 September 17th, 2003 01:47 AM
Passing Parameter tgopal Javascript 3 August 7th, 2003 07:54 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.