I am working on Sql Server 2000 and Delphi 5. When I try to open a table :
Table1.open;
I get the following error message :
Connection is busy with results for another hstmt.
I am new to Sql Server so please keep the explanation simple !!!
I have already read this got something to do with forward-only, read-only cursor. But I don't know what a forward-only, read-only cursor mean. Please explain !!
Thanks
KarenHowdy
A cursor collects a record set from a database. The cursor has a pointer that can move around in the record set to read a particular row etc. A forward only cursor can only read down ( i.e. forward ) through the record set, so if you are trying to go backwards through the record set it may not let you.
I dont know anything about Delphi, but from SQL Books on Line :
----------
SQLTables
When restricted to the current database, SQLTables executes the Transact-SQL procedure sp_tables to report table catalog data for Microsoft SQL Server.
The following table shows SQLTables parameter mapping for sp_tables stored procedure execution.
SQLTables parameter name sp_tables parameter name
CatalogName table_qualifier
SchemaName table_owner
TableName table_name
TableType table_type
SQLTables can be executed on a static server cursor. An attempt to execute SQLTables on an updatable (dynamic or keyset) cursor will return SQL_SUCCESS_WITH_INFO indicating that the cursor type has been changed.
SQLTables reports tables from all databases when the CatalogName parameter is SQL_ALL_CATALOGS and all other parameters contain default values (NULL pointers). SQLTables does not make use of sp_tables in this special case.
To report available catalogs, schemas, and table types, SQLTables makes special use of empty strings (zero-length byte pointers). Empty strings are not default values (NULL pointers).
The SQL Server ODBC driver supports reporting information for tables on linked servers by accepting a two-part name for the CatalogName parameter: Linked_Server_Name.Catalog_Name.
SQLTables returns information about any tables whose names match TableName and are owned by the current user.
Example
// Get a list of all tables in the current database.
SQLTables(hstmt, NULL, 0, NULL, 0, NULL, 0, NULL,0);
// Get a list of all tables in all databases.
SQLTables(hstmt, (SQLCHAR*) "%", SQL_NTS, NULL, 0, NULL, 0, NULL,0);
// Get a list of databases on the current connection's server.
SQLTables(hstmt, (SQLCHAR*) "%", SQL_NTS, (SQLCHAR*)"", 0, (SQLCHAR*)"",
0, NULL, 0);
Cheers,
SG
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment