0

So I'm trying to create the following: I have 3 Dropdowns (one for the day, another for the month and other for the year) and I want to concatenate these three elements on the SQL Database.

Basically, it's a Birthday date I want to save.

Pictures:

Where the user select the Birthday Date

Where I want to save the Date 'all together' (day, month and year)

Thank you for your help!

André Gomes
  • 59
  • 1
  • 9

1 Answers1

0

Get the date and using following snippet to store the value to database.

var date = new DateTime(year, month, date);


        SqlCommand cmd = new SqlCommand("INSERT INTO <table> (<column>) VALUES (@value)", connection);
        cmd.Parameters.AddWithValue("@value", date);

        cmd.ExecuteNonQuery();
ISHIDA
  • 4,700
  • 2
  • 16
  • 30