Hey I want to Fetch the date from the date picker and add that date into my database birthdate column soo plzzz help me out...
here Form View and Grid View
just tell me syntax how to store the date value in Database birthdate column! plzzz give me solution in C#.net only...
WinForms: The datepicker has a property called "Value" and it is of DateTime data type. Use that.
Web Forms: if you are using JQuery, just do
var date = $("#myDateControl").val();
Then how you store the value depends on what database you are using (Sql, Oracle, etc) and whether you are using Entity Framework (or other ORM) or not... give more details if you want a more thorough answer.
EDIT
Based on your comments, I would do something like this:
using (var connection - new SqlConnection("my connection string"))
{
using (var command = connection.CreateCommand())
{
command.CommandText = string.Format("INSERT INTO Stu_inf(Enrollno, Firstname, Lastname, Birthdate) VALUES ('{0}', '{1}', '{2}', '{3}')", txtEnrollno.Text, txtFname.Text, txtLname.Text, mtxtBdate.Value.ToString("yyyy-MM-dd"));
connection.Open();
command.ExecuteNonQuery();
connection.Close();
}
}
I wrote this all from memory, so you may get a small syntax error or something.. but that's the idea... hope it helps