Dim data1 As String
Dim conn1 As SqlConnection
Dim cmd1 As New SqlCommand
Dim ada1 As New SqlDataAdapter()
Dim ds1 As New DataSet
data1 = lbldmdate.Text.ToString()
conn1 = New SqlConnection("Persist Security Info=false;User Id=justin;Data Source=ARULJUSTIN\SQLEXPRESS;Initial Catalog=firemaintain;Integrated Security=True;Pooling=False")
conn1.Open()
ada1 = New SqlDataAdapter("select Recordno, uhnumber,uhbuilding,uhlocation from hydrantmaintain WHERE unndate= '" & Today.ToString("dd/mm/yyyy") & "'", conn)
ada1.Fill(ds1)
dgnxtmdates.DataSource = ds1.Tables(0)
我得到一個錯誤:「不能轉換從日期字符串」日期字符串轉換
當你得到這個錯誤嗎?編譯時間?運行?如果是從'ToString'函數(我不這麼認爲)或Ado.NET組件?還是從數據庫?哪條線?您的問題可能會因此級別的信息而關閉。 – nawfal
我得到一個編譯時錯誤sql異常「轉換日期和/或時間從字符串轉換失敗」 – Justin
賈斯汀,這是運行時異常,不編譯時間.. – nawfal