• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 225
  • Last Modified:

objcmd.Parameters.Add = 3 Pulldown Values

I want this:
objcmd.Parameters.Add("@SDOB", SqlDbType.DateTime).Value =

to equal the values from my three pulldowns:
bdaymonth.SelectedValue
bdayday.SelectedValue
bdayyear.SelectedValue

in this format:

11/28/1968

How would I do that?

I'm thinking maybe something like this:
objcmd.Parameters.Add("@SDOB", SqlDbType.DateTime).Value = bdaymonth.SelectedValue + bdayday.SelectedValue + bdayyear.SelectedValue

0
net_susan
Asked:
net_susan
1 Solution
 
DBAduck - Ben MillerPrincipal ConsultantCommented:
Or you could do something like:

objcmd.Parameters.Add("@SDOB", SqlDbType.DateTime).Value = String.Format("{0}/{1}/{2}", bdaymonth.SelectedValue, bdayday.SelectedValue, bdayyear.SelectedValue)

And if you wanted it to be in a DateTime format then you would just wrap it with

DateTime.Parse(string.Format......)

Ben.
0
 
net_susanAuthor Commented:
Groovy. :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now