im trying to convert my date from MySQL to a textbox.text and its giving the msg
unable to convert MySQL date/time value to system.datetime

dim tempdate as date

 TempDate = dr.Item("dob").ToString
                txtDate.Text = TempDate.ToString

someone please help

Try using like this:

TempDate = dr.Item("dob").ToString
txtDate.Text = TempDate.ToString("yyyy-MM-dd")

still giving me the same error message. is there any other method?

What does dr.Item("dob").ToString returns?

If dr.Item("dob") is a valid date, this should work:

TempDate = new Date(dr.Item("dob").ToString("yyyy-MM-dd"))
txtDate.Text = TempDate.ToString("yyyy-MM-dd")

solved

added the following on the connection string

Convert Zero Datetime=True" & "Allow Zero Datetime=True

thanx alot

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.