473,513 Members | 3,317 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inserting values into sql dbase from a dropdownlist control

I'm trying to add a drop down list to my data insertion script, using
the sqlparamter object . The form coding on the web page:
<asp:dropdownlist id="frmstate" runat="server">
<asp:ListItem Value="nv" Selected="True">-</asp:ListItem>
<asp:ListItem Value="az">arizona</asp:ListItem>
<asp:ListItem Value="ca">cal</asp:ListItem>
<asp:ListItem Value="or">oregon</asp:ListItem>

</asp:dropdownlist>

....and the process example i'm using below to insert the data and
bind it:
cmd.Parameters.Add(New SQLParameter("@state", frmstate.item.key))
cmd.Parameters.Add(New SQLParameter("@city", frmcity.text))

....getting an error on the @state line, as "item" is not a member of
'System.Web.UI.WebControls.DropDownList' - just wondering what syntax
to use for frmstate.item.key , as using .text along with asp:textbox
controls is working fine for me.

thanks in advance
chumley
Jul 21 '05 #1
0 1222

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1892
by: adam | last post by:
i have custom user control and i'm trying to pass values to custom user control......I need help it seems to me i cannot pass the value to user control from dropdownlist. I have property in a control. In a default.aspx page <SkinExample:Hello id="HelloControl" SkinName="red" runat="server" /> i can pass the value, it works fine, but from the...
5
2343
by: Bryan Ax | last post by:
I have a page that has two copies of the same control in it. The control is: BorrowerControl the two references to it in the page are bControl1 cobControl1
1
1305
by: | last post by:
This is a crosspost from a less-frequented (but more focused) asp.net group; I didn't receive an answer that worked. I'd like to get this form functional. Could someone help on what's probably a simple syntax issue? I've attempted my due diligence with the usual books and references...but I'm new to ASP.NET. Question follows: The Code...
9
2329
by: james.e.coleman | last post by:
Hello, I have created a custom dropdownlist that is used multiple times within a single page. When trying to set the values of the controls with the page in which they are being used, they all are set to the value of the last control. I found this link: http://www.codecomments.com/archive315-2005-1-366113.html which I think explains the...
0
261
by: Chumley the Walrus | last post by:
I'm trying to add a drop down list to my data insertion script, using the sqlparamter object . The form coding on the web page: <asp:dropdownlist id="frmstate" runat="server"> <asp:ListItem Value="nv" Selected="True">-</asp:ListItem> <asp:ListItem Value="az">arizona</asp:ListItem> <asp:ListItem Value="ca">cal</asp:ListItem>...
2
1682
by: Pipo | last post by:
Nobody knows how to get the values provided in the client can be read in the user-control? If have made a Web Custom Control with 2 textboxes and 1 dropdownlist. The user fills in my control (the textboxes and the dropdownlist) and lots more stuff on the page. When the user wants to save the page he'll click the save button. The server gets...
5
2176
by: hfk0 | last post by:
Hi, I'm new to ASP.net, SQL Server and visual studio.net, and I'm having problem inserting and storing data from a web form to a SQL database. I created a simple ASP.NET web form, a simple SQL database, a database connection (using the SQlDataSource Web Control from the Toolbox), and created the following stored procedure in Visual...
4
1457
by: =?Utf-8?B?R3JlZyBTdGV2ZW5z?= | last post by:
I have an ASP.NET page with a form that contains two user controls: <%@ Register TagPrefix="x" TagName="c1" Src="ctl1.ascx" %> <%@ Register TagPrefix="x" TagName="c2" Src="ctl2.ascx" %> <body> <form runat="Server"> <x:c1 id="con1" runat="Server"> <x:c2 id="con2" runat="Server"> <form> </body>
4
8536
by: pankajsingh5k | last post by:
Hi guys, These question is for all the experts... Please help me before my brain explodes The problem is again with the formview control.. I have a formview and i have to use it that when it displays it shows values from the database and i have a link button edit on the ItemTemplate that changes the mode to edit mode and allows to...
0
7177
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7394
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7123
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4756
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3248
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3237
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.