Hi,
I retrive date from database. It is in the format of yyyy-mm-dd.
Now i want to put this date into masked textbox. Masked text box date format is dd-mm-yyyy.
I am not getting correct date format in my masked textbox.
Darma
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sudhakar ChaudharyPosted Jul 23, 2012, 8:13 AM
{
con.Open();
}
SqlCommand cmd = new SqlCommand("select convert(varchar(10),date,103)as date from table1", con);
maskedTextBox1.Text = (string)cmd.ExecuteScalar();
SqlCommand cmd = new SqlCommand("insert into table1 values('','','','" + Convert.ToDateTime(maskedTextBox1.Text).ToLongDateString() + "')", con);
if (con.State == ConnectionState.Closed)
{
con.Open();
}
cmd.ExecuteNonQuery();
Abhijit baruaPosted Jul 23, 2012, 8:10 AM