Theos PowerBasic Museum 2017

Archive => Discussion - Legacy Software (PBWIN 9.0+/PBCC 5.0+) => Topic started by: David Marco on September 24, 2008, 06:40:39 PM

Title: ODBC Services
Post by: David Marco on September 24, 2008, 06:40:39 PM
Hi All,

I'm trying to create a ODBC Services.

I'm using the BIBLIO.MDB for compatibility issues.

I addapted the EX_ODBC_06.bas sample program in order to get the tablenames.

After this, following the sample of EX_ODBC_08.bas program, in order to get the fieldnames, I do this:

r = SQLExecDirect (hStmt, "SELECT * FROM " & szTableName, %SQL_NTS)

All works fine, but BIBIO.mdb has a table named "Title Author" with a space between words.
Each time szTableName is "Title Author", I received a error message number 4294965991.
I Receive this message in spanish, the translate message wold be something like this:

SQLState: 42S02
Native Error: 4294965991
[Microsoft][Microsoft Access ODBC Driver] Microsoft Jet Motor can't find the Table 'Title'. Be sure that this exists and its name is well written.

If I change the line:
r = SQLExecDirect (hStmt, "SELECT TOP 20 * FROM Titles ORDER BY Title", %SQL_NTS)
for this one:
r = SQLExecDirect (hStmt, "SELECT TOP 20 * FROM Title Author", %SQL_NTS)

in EX_ODBC_08.bas program, I get the same result.

Does any know the way to do a replacement of the space character, in order to get the fieldnames ?

Thanks in advance,
David
Title: Re: ODBC Services
Post by: José Roca on September 24, 2008, 06:55:42 PM
Use r = SQLExecDirect (hStmt, "SELECT TOP 20 * FROM [Title Author]", %SQL_NTS)
Title: Re: ODBC Services
Post by: David Marco on September 24, 2008, 07:04:53 PM
Thanks José,

Now works fine.

I will assume the same behavior with field names ( put them between brackets [] ). Isn't it ?

Saludos desde Buenos Aires, Argentina
David
Title: Re: ODBC Services
Post by: José Roca on September 24, 2008, 07:29:42 PM
 
Yes.