傳遞給我的自定義函數的字符串如下:轉換失敗
SELECT key FROM ubis WHERE MemberID = '144'
AND To >='11/7/2009 9:11:23 pm'
AND From <= '11/7/2009 9:11:23 pm'
Public Shared Function GetDataTable(ByVal CmdText As String) As DataTable
Dim myConn As New SqlConnection(ConfigurationManager.ConnectionStrings("Conn").ConnectionString)
Dim myCmd As New SqlCommand(CmdText, myConn)
myConn.Open()
Dim myReader As SqlDataReader = myCmd.ExecuteReader()
Dim myTable As New DataTable()
myTable.Load(myReader)
myConn.Close()
Return (myTable)
End Function
,這裏是錯誤我得到的, 轉換從字符串轉換日期時間失敗時
我知道datetime字段作爲字符串傳遞給函數,但我有什麼選擇?
月11日...今天 – OrElse 2009-07-11 20:32:30
7月11日的! dd/MM/yyyy – OrElse 2009-07-11 20:50:04