Problem in the DDT.ADODriver SQLStatement and ConnectionString
Hi Guys,
I have in my VB application two date pickers DTPfrom and DTPto
I select from them two dates, a SQL statement on access DB called "School" is executed and in MSFlexGrid, I call it Grid in the script,the records between these dates are displayed
I want MyDriver to execute the SQL Statement as well to ensure that Grid displays the right records
==> I tried to make it and I have error in the Code (Cannot convert from type "Dispatch" to "String")
==> here is the script
Dim DTPfrom,DTPto
Set DTPfrom = control2.Frame1.DTPfrom
Set DTPto= control2.Frame1.DTPto
Dim SQLStatement
Dim ConnectionString
Dim Driver
==> Those three Lines throw Exceptions
'Set ConnectionString="DSN=School;DBQ=D:\TestingProjects\School Access\School Project\Project\School.mdb;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;UID=admin;"
'Set SQLStatement="SELECT * FROM STUDENT WHERE ADMISSION_DATE >= #" & DTPfrom & "# and ADMISSION_DATE <= #" & DTPto & "# ORDER BY ADMISSION_DATE,ID"
'Set SQLStatement="SELECT * FROM STUDENT WHERE ADMISSION_DATE >= #" & Format(DTPfrom, "dd-mmm-yy") & "# and ADMISSION_DATE <= #" & Format(DTPto, "dd-mmm-yy") & "# ORDER BY ADMISSION_DATE,ID"
'Create Driver
Set Driver=DDT.ADODriver(ConnectionString,SQLStatement)
If Grid.Cols <> Driver.ColumnCount Then
Log.Error "Columns are not of the same count"
Exit Sub
End If
'Retrieve from Driver
Dim s
While Driver.EOF() = False
s=Driver.Value(0)&Driver.Value(1)&Driver.Value(2)&Driver.Value(3)&Driver.Value(4)&Driver.Value(5)
Log.Message (s)
Driver.Next
Wend