we r trying to insert date from datetime picker into mssqlserver 2005 but it also enter defult time(00:00) with it in database.
using we want only date...

& xyzdtp.value.date &

Recommended Answers

All 12 Replies

you can do like this

datetimepicker.value.date.tostring()
'or you can set format property according to your requirement .

Regards

and if you have datatype datetime in your db , then auto time will be added in your records , this will not effect any thing , and you can perform any task.

Regads

and if you have datatype datetime in your db , then auto time will be added in your records , this will not effect any thing , and you can perform any task.

Regads

'ya in mssql2005 datatype is datetime so...but it affect while comparing....
'also using formate property it enter time in database..

no it will not effect your result can you please write your query here , so that i can better ans you.

dateTimePicker1.DataBindings.Add("text", dataGridView1.DataSource, "Ngaysinh");
I try get dd/mm/yyyy from datagridview but datagirdview show mysql: ex: 12/02/1990 12:00:00.
how to show datetimepicker when i click datagridview row

I use it simple way. just: datetimepicker.text

but you have to change the format from LONG to CUSTOM

and at CostumFormat use any format you want
dddd-MM-yyyy = 11-4-2015

You can use:

Dim startDate as String
startDate = DateTimePicker1.Value.ToString("yyyy/MM/dd")

Or:

Dim startDate as String
startDate = DateTimePicker1.Value.Date

dim date as string=format(datetimepicker1.value,"dd-MM-yyyy")

change the datatype of startDate from datetime to date in your sql server

This will solve the problem.

//orcon is oracle connection
orcon.Open();
OracleCommand c = new OracleCommand();
c.Connection = orcon;
c.CommandText = "insert into xx values('"+dateTimePicker1.Value.ToString()+"')
c.ExecuteNonQuery();

        //in c# im getting error please i need help to insert date in oracle10g

Thanks everyone for your response and support.

while reading data from sql
DateTime dt = Convert.ToDateTime(dr["LastDateBidSub"]);
TextBox1.Text = (dt.ToString("dd/MM/yyyy").ToString());

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.