|
-
Apr 18th, 2008, 04:24 PM
#1
Thread Starter
Frenzied Member
FoxPro connection to MSSQL - Query problems
Starting off, I know VFP is terrible. However, due to many stipulations beyond my control I have to use VFP to execute all MSSQL queries.
So I am making a Visual Fox Pro application that will execute queries for those I don't want executing their own queries.
So we have a QueryType Variable, Editbox and a FromTable combo box. There are several of these running down the form for when you need to run more than one query at a time, the goal here is to Union them.
However, I am quite new to all Database queries and am having trouble making the Union part work.
This is all in a form within Visual Fox Pro. The code I pasted below if in a command button execute sub.
So here is what does work:
Code:
?SQLEXEC(hConn,QueryType + " " + Muffin + " from " + TableName + " WHERE imp_date>GETDATE()-20","localcursor")
On to the code that does not work:
Code:
?SQLEXEC(hConn,QueryType + " " + Muffin + " from " + TableName + " WHERE imp_date>GETDATE()-20 " + " union " + QueryType + " " + Muffin2 + " from " + TableName2 + " WHERE imp_date>GETDATE()-20 ","localcursor")
Any and all help is appreciated.
-
Apr 18th, 2008, 07:16 PM
#2
Re: FoxPro connection to MSSQL - Query problems
What happens when you run the code that does not work? Are you getting errors? Bad returns?
-
Apr 19th, 2008, 12:04 PM
#3
Thread Starter
Frenzied Member
Re: FoxPro connection to MSSQL - Query problems
It throws an error. If you try to run it in FoxPro normally it gives a Missing Operand error. so if I could get the query to work in Foxpro normally using the mssql connection, doves would fly into the air from behind me.
Thanks, Hack. Long time since I been here, glad you're still here.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|