VB2012 FormatException未处理,String未被识别为有效的DateTime

时间:2016-08-13 09:32:41

标签: mysql vb.net visual-studio-2012

将不会读取DateTimePicker1,但会读取另一个函数。我想知道此代码中的问题是什么。

Public com As New MySql.Data.MySqlClient.MySqlCommand
Public da As New MySql.Data.MySqlClient.MySqlDataAdapter
Public dr As MySql.Data.MySqlClient.MySqlDataReader
Public dt As New DataTable
Public ds As DataSet

Private Sub frmupdateaccount_Load(sender As Object, e As EventArgs) Handles MyBase.Load


    Dim READER As MySql.Data.MySqlClient.MySqlDataReader
    Dim query As String

    con.Open()

    query = "Select * from user_tbl where userid='" & txtuserid.Text & "'"
    com = New MySql.Data.MySqlClient.MySqlCommand(query, con)

    READER = com.ExecuteReader

    While READER.Read

        txtcontactnumber.Text = READER.GetString("contactnumber")
        cbxgender.Text = READER.GetString("gender")
        datetimepicker1.Text = READER.GetString("dateofbirth")

    End While

    con.Close()
End Sub

0 个答案:

没有答案