Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL cursor select problem
Message
 
 
À
20/07/2003 19:15:07
Alan Harris-Reid
Baseline Data Services
Devon, Royaume Uni
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00811876
Message ID:
00811879
Vues:
16
This message has been marked as the solution to the initial question of the thread.
Hi Alan,

You can use AERROR() function to get detailed descripton of ODBC error.
It's better to enclouse string literals in single quotes because it's standard string literal delimiter in SQL Server. The use of double quotes is controlled by SET QUOTED_IDENTIFIER command. If it set to ON double quotes cannot be used for string literals. See BOL for details. Try
lnTest2 = SQLEXEC(gnConnHandle, ;
          [SELECT * FROM dbo.Policy WHERE cStatusId='C'], ;
          'AA')
IF lnTest2 = -1
  * ODBC Error
  DIMENSION laError[1]
  AERROR(laError)
  ... 
ENDIF     
>I am trying to select a cursor from a MSDE database using the following code...
>gnConnHandle = SQLCONNECT('KCHP')         && returns 9
>lnTest1 = SQLSETPROP(gnConnHandle, 'asynchronous', .F.)  && returns 1 (ok)
>lnTest2 = SQLEXEC(gnConnHandle, ;
>          'SELECT * FROM dbo.Policy WHERE cStatusId="C"', ;
>          'AA')     && returns -1 (connection-level error)
>
>No cursor is produced. I cannot fathom why the last line is failing. There are no error messages. Table dbo.Policy definitely exists in the database the connection is pointing to, as does the field cStatusId. Has anyone out there any idea what I might be missing?
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform