add from a drop down list

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello All!

I have a ddl that holds the 12 months of the year. I added the items in the
collection of the ddl control. But how can take that selected month from the
ddl and save it to my table. Are there any examples on this. There is alot
of stuff for binding data from a table. But I can't find anything to show me
how to add from a ddl.

TIA!!!

Rudy
 
Hi Jason!
Thanks for the response. I looked at the sample. It looks like I would
treat a ddl just like I would treat a text box. In my form, I have a
combination of textboxe, and ddl. Would I treat them the same, even though I
have the items loaded in the the collection of the prorperties. Here is a
snipit. Only code for the textboxes.

Private Sub UpdateTextBox()
Dim conUpdTxt As SqlConnection
Dim cmdUpdtxt As SqlCommand
Dim parmReturnValue As SqlParameter
Dim intResult As Integer

conUpdTxt = New
SqlConnection("Server=localhost;UID=*****;PWD=****;Database=Golfer")

cmdUpdtxt = New SqlCommand("NCProfile", conUpdTxt)
cmdUpdtxt.CommandType = CommandType.StoredProcedure

cmdUpdtxt.Parameters.Add("@artist", txtArtist.Text)
cmdUpdtxt.Parameters.Add("@movie", txtMovie.Text)
cmdUpdtxt.Parameters.Add("@notwork", txtNotWork.Text)
conUpdTxt.Open()
cmdUpdtxt.ExecuteNonQuery()

Thanks!!!

Rudy
 
Hi Jason!

Not to beat a dead horse. So if I had the following for my textbox.

cmdUpdtxt.Parameters.Add("@notwork", txtNotWork.Text)
Then my ddl should look something like this.
cmdUpdtxt.Parameters.Add("@year",.....Now this is where I'm a little
confused. Do I put ddlyear, the name of my control ddlYear.SelectedItem.Text)
Thanks for all your help on this!

Rudy
 
Hello Jason,

Just wanted to let you know, after messing around with it tonight, I finally
got it!
cmdUpdtxt.Parameters.Add("@birthmonth", ddlMonth.SelectedValue) is the way
that worked for me. Thanks again for your help, it's appreciated!!

Rudy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top