Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics 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 December 31st, 2004, 10:18 AM
Authorized User
 
Join Date: Aug 2004
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default dropdown save into sql table

hi all,
i have a dropdown list that retrive data from table and i add this drop dwon list to a form.
my question is how to save the data from drop down list into a table in sql server?

 
Old January 1st, 2005, 02:59 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

do You want to save all content from the drop down or only the selected value from the dropdown?

Om Prakash
 
Old January 2nd, 2005, 12:52 AM
Authorized User
 
Join Date: Aug 2004
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i would like to save the selected item from the drop down list only

 
Old January 3rd, 2005, 12:36 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

1. Make use of a SqlCommand object to insert the value from dropdown into DB.
2. Get the choosen value from dropdown make use of "SelectedValue"

For example,

SqlCommand InsertCmd = new SqlCommand("Insert into Table1 values ( @FName," +
         " @City)" ;
InsertCmd .Parameters.Add("@FName",FName.Text);
InsertCmd .Parameters.Add("@City",City.SelectedValue);


Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
2 table fields into 1 dropdown selectbox sdagger Classic ASP Basics 2 September 23rd, 2008 03:42 PM
Updating a table from a dropdown GS ASP.NET 2.0 Basics 2 March 18th, 2007 07:22 AM
Updating table from dropdown list GS ASP.NET 2.0 Professional 2 March 18th, 2007 07:22 AM
Modifying table dynamically,storing dropdown value santy_capri Classic ASP Databases 0 July 25th, 2006 06:09 AM
How to save a table in another name rohan1958 Access 3 January 31st, 2005 09:36 AM





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