Hallo,
ich möchte eine SQL DB abfragen mit mehreren bedingungen:
nun wird per msg ausgegeben: incorect syntax near'.2014'.
was mache ich falsch?
ich möchte eine SQL DB abfragen mit mehreren bedingungen:
nun wird per msg ausgegeben: incorect syntax near'.2014'.
VB.NET-Quellcode
- Dim line As String = TB3.Text
- Dim date1 As Date = VonCalendar1.SelectionStartDim date2 As Date = BisCalendar2.SelectionEnd
- Dim sch1 As String = VonSchicht.TextDim sch2 As String = BisSchicht.Text
- Dim statement As String = "SELECT * FROM FSK_IO_DATA WHERE LINE_NR = " & line & " AND DATE_FROM >=CONVERT(DATETIME," & date1 & ", 104) AND DATE_TO <=CONVERT(DATETIME," & date2 & ", 104) "Dim dt As New DataTable("Temp")
- Dim Sql_DA As New SqlDataAdapter(statement, m_SqlCon)
- Try
- Sql_DA.Fill(dt)
- Catch ex As ExceptionMessageBox.Show(ex.Message)
- End TryWith DGV
- .DataSource = Nothing
- .DataSource = dt.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells
- .ShowCellErrors = False
- .ShowRowErrors = False
- End With
was mache ich falsch?