![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Dear Vixens and Reynards: I am just starting to connect to SQL Server 2008 Express through VFP, and I have some questions. URLs are welcome. There is a lot of Web to sift through, and not everyone contributing is correct. 1) What exactly is a connection-level error? I have been able to get this error with sqlexec() by connecting without specifying a database and then trying to select, but what else does this mean? 2) What exactly is an environment-level error? 3) Suppose that I have more than one result set. (Say that I do two queries at once.) Are the result set names guaranteed to come back in the array in same order as the queries? 4) sqlexec() returns 0 if the command is still executing. When does this happen, and what do I do about it when it does? 5) Because I am experimenting, I often have program crashes and have connections left hanging. How can I close all of them in one command? (I can loop with sqldisconnect(), but this is kludgy.) 6) Do you have any tips that seem indicated at this point? |
#3
| ||||
| ||||
|
|
1) What exactly is a connection-level error? I have been able to get this error with sqlexec() by connecting without specifying a database and then trying to select, but what else does this mean? 2) What exactly is an environment-level error? 3) Suppose that I have more than one result set. (Say that I do two queries at once.) Are the result set names guaranteed to come back in the array in same order as the queries? 4) sqlexec() returns 0 if the command is still executing. When does this happen, and what do I do about it when it does? |
|
5) Because I am experimenting, I often have program crashes and have connections left hanging. How can I close all of them in one command? (I can loop with sqldisconnect(), but this is kludgy.) |
|
6) Do you have any tips that seem indicated at this point? Two more: 7) How does one trap errors? Sometimes, SQL Server pops up a dialog box. I would prefer to handle the problem in my program. |
|
8) How does one get all of the return codes? For example, if I try to create a database that already exists, how would I be able to tell that that was the error? |
#4
| |||
| |||
|
#5
| |||
| |||
|
#6
| |||
| |||
|
|
5) Because I am experimenting, I often have program crashes and have connections left hanging. How can I close all of them in one command? |
#7
| |||
| |||
|
|
5) Because I am experimenting, I often have program crashes and have connections left hanging. How can I close all of them in one command? (I can loop with sqldisconnect(), but this is kludgy.) Maybe SQL server is different, but with Postgres, I have never needed more than one connection. I make a connection and store the handle into a global variable. If the global variable is not zero, then I know that the connection has been made so I don't need to connect again. |
#8
| |||
| |||
|
|
On Mon, 4 Apr 2011 08:00:13 -0700 (PDT), Kevin Clark kevclark64 (AT) gmail (DOT) com> wrote: 5) Because I am experimenting, I often have program crashes and have connections left hanging. How can I close all of them in one command? (I can loop with sqldisconnect(), but this is kludgy.) Maybe SQL server is different, but with Postgres, I have never needed more than one connection. I make a connection and store the handle into a global variable. If the global variable is not zero, then I know that the connection has been made so I don't need to connect again. It is not a matter of needing but a matter of having. If a test program crashes, its connection is still open. If I rerun the program, another connection will be opened. Either I have to close VFP or run through all of the numbers. Sincerely, Gene Wirchenko |
#9
| |||
| |||
|
|
If I rerun the program, another connection will be opened. |
#10
| |||
| |||
|
|
If I rerun the program, another connection will be opened. Maybe I'm wrong, but I don't think you have to open another connection each time the program runs. Assuming that you already have established the connection within the FoxPro environment, all you need to know is the handle in order to run more queries. If you assign the handle to a global variable, and then check for non-zero value of the global variable during subsequent runs of the program, you don't have to open up subsequent connections. Regards, Kevin Clark |
![]() |
| Thread Tools | |
| Display Modes | |
| |