Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8422465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:27:14+00:00 2026-06-10T03:27:14+00:00

I have dropdownlist ( id=myDDL ). I have the method ( updateTable_byDDL ) for

  • 0

I have dropdownlist (id="myDDL").

I have the method (updateTable_byDDL) for update my sql table, the method work great when I put manual value in the SET="bla" ..

But when I write in the SET= '"+ myDDL.Text.ToString() + "', the column on the SQL update to empty.

The dropdownlist is binding from array that I put outside the page_load (in the class), and I am binding it on the page load:

    myDDL.DataSource = array;
    myDDL.DataBind();

In the aspx page I can see well the array values in the dropdownlist, but after I chose the item I want – and click on the button, the column turn to empty.

Where am I going wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:27:16+00:00Added an answer on June 10, 2026 at 3:27 am
    1. You should take myDDL.SelectedItem.Text
    2. You should use parameters to avoid SQL injection

    Check it out:

       YourUpdateCommand.CommandText = "UPDATE table SET column = @NewValue WHERE conditions";
    
       YourUpdateCommand.Parameters.Add("@NewValue", System.Data.SqlDbType.VarChar, 100); //or whatever
    
       YourUpdateCommand.Parameters["@NewValue"].Value = myDDL.SelectedItem.Text;
    
       YourUpdateCommand.ExecuteNonQuery();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have dropdownlist with the values: <select id=myddl name=myddl> <option value=1>One</option> <option value=2>Twooo</option> <option
I have Dropdownlist on my page and its selectedindexchanged method created in code behind
I have a dropdownlist that has the value of two columns in it... One
I have a Dropdownlist <select name=cate> <option value=h>India</option> <option value=m>USA</option> <option value=c>England</option> </select> <input
I have a dropdownlist with values -1,1,2 and text A,B,C i wanna set B
I have dropdownlist and set autopostback Property to true.. the problem is that i
I have a dropdownlist with following options: <asp:DropDownList ID=ddlTaxStatus runat=server OnPreRender=ddlContainerStatus_PreRender> <asp:ListItem Text=--Select-- Value=-1></asp:ListItem>
I have a DropDownList and my method to populate it works as follows: ddlStaff.Items.Clear();
I have a dropdownlist with 5 items. Value of last item is other. By
I have a dropdownlist, whose datasource is from SQL server. <asp:DropDownList ID=State runat=server DataSourceID=SqlDataSource1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.