VB3 & SQL 
Author Message
 VB3 & SQL

Hi !

I'm trying to access an Access 1.1 database using SQL statements within a
VB3.0 pro application.

All my SQL statements are working fine EXCEPT when a Date expression is
present in the WHERE clause.

For example, an instruction like the following one won't work at all:

...
Dim MyDynaSet as Dynaset
Set MyDynaSet = DataB.CreateDynaset("SELECT * FROM MyTable WHERE Date_Sale =
'" & TheDate & "'".

I even tried to build such SQL statements within the Visual Data application
that accompanies Visual Basic 3.0 (\vb\samples\visdata\visdata.mak) and it
didn't work at all.

Should you have an idea, please let me know.

Many thanks !

Jean Valere N. Edou



Tue, 27 Oct 1998 03:00:00 GMT  
 VB3 & SQL


Quote:
>Dim MyDynaSet as Dynaset
>Set MyDynaSet = DataB.CreateDynaset("SELECT * FROM MyTable WHERE Date_Sale =
>'" & TheDate & "'".

Try this:

"SELECT * FROM MyTable WHERE Date_Sale = #" & TheDate & "#;"

You need to put pound signs (#) around dates.

-----

Joe

Never underestimate the power of a WAG.



Thu, 29 Oct 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. SQL & VB3 problem

2. SQL-Server & VB3 problems

3. vb3 &SQL

4. VB3, Intersolv MultiLink VB & SQL Server 6.5

5. SQL 7 & SQL 2000

6. *&*&*&* Date math question *&*&*&*

7. Store and retrieve BLOB using VB3 & VBSQL & SQL Server

8. Move From VB3 & Word7 to VB3 & Word97

9. VB3 & 4 COMMAND BUTTONS W/ IMAGE

10. VB3 & Access V7

11. Crystal Reports & VB3

12. VB3 & MS Access 2.0 ...SECURITY

 

 
Powered by phpBB® Forum Software