• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 221
  • 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

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

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