What is wrong with this code?
No error, but no results. My DataGridView_sent does not get filled.
Dim objConn As New System.Data.OracleClient.OracleConnection
Dim objCmd As New System.Data.OracleClient.OracleCommand
Dim dtAdapter As New System.Data.OracleClient.OracleDataAdapter
Dim ds As New DataSet
Dim strConnString, strSQL As String
strConnString = "Data Source=db;User Id=user;Password=pass;"
strSQL = "select * from table where sentdate between '" & date1 & "' and '" & date2 & "'"
objConn.ConnectionString = strConnString
With objCmd
.Connection = objConn
.CommandText = strSQL
.CommandType = CommandType.Text
End With
dtAdapter.SelectCommand = objCmd
dtAdapter.Fill(ds)
DataGridView_sent.DataSource = ds
dtAdapter = Nothing
objConn.Close()
objConn = Nothing
This is probably caused by incorrect representation of dates.
You should use parametrized queries and let the Oracle Provider render in the correct mode your date fields values