Results 1 to 3 of 3

Thread: FoxPro connection to MSSQL - Query problems

  1. #1

    Thread Starter
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068

    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.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: FoxPro connection to MSSQL - Query problems

    What happens when you run the code that does not work? Are you getting errors? Bad returns?

  3. #3

    Thread Starter
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068

    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
  •  



Click Here to Expand Forum to Full Width