Solved

Join with VB5, ODBC and SYBASE

Posted on 1998-11-05
6
326 Views
Last Modified: 2013-12-25
Hi,

I want to do a select into a 2 tables.
I'am using VB5 and ODBC with SYBASE database. The purpose of my program is  to do a cgi.
To do the select, i'am using a recordset. When i opening this recordset i use INNER JOIN to do the join between tables.
But when the command run, i have this error :
Erreur de syntaxe dans la clause FROM. Error Number =  3131

The sql string is :
"SELECT nr FROM products INNER JOIN text_attribute WHERE products.nr = text_attribute.productnr;"

Somebody can help me ?
Thanks
0
Comment
Question by:didede
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 

Author Comment

by:didede
ID: 1497459
if i use [text_attribute] instead of text_attribute and ON instead of WHERE i have the following error :
ODBC -- l'appel a échoué. Error Number =  3146
0
 
LVL 1

Expert Comment

by:zivf
ID: 1497460
1. a select is FROM and not INTO.
2. INNER JOIN must be ON something, oterwise it will be OUTER, isn't it?
3. first complete the join part (it's syntax is currently incorrect and you got a message for it, and this is no excuse to add a comment to justify why you write bad SQL)
4. try to use table name preceding the field names (also in the JOIN you should write and the WHERE)
5. find out what ODBC error 3146 means. (clue: ODBC trace)
0
 
LVL 1

Expert Comment

by:zivf
ID: 1497461
1. a select is FROM and not INTO.
2. INNER JOIN must be ON something, oterwise it will be OUTER, isn't it?
3. first complete the join part (it's syntax is currently incorrect and you got a message for it, and this is no excuse to add a comment to justify why you write bad SQL)
4. try to use table name preceding the field names (also in the JOIN you should write and the WHERE)
5. find out what ODBC error 3146 means. (clue: ODBC trace)
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Accepted Solution

by:
vspeter earned 50 total points
ID: 1497462
Try this

SELECT nr FROM products INNER JOIN text_attribute ON products.nr = text_attribute.productnr

Assuming that you have field 'nr' in 'products' table contains the same information as field 'productnr' in 'text_attribute' table.

Cheers,
0
 

Author Comment

by:didede
ID: 1497463
Ok the syntaxe of my SQL was not correct but the problem doesnt concern the SQL statment.
After some diagnostics, i have found that the odbc user havent grant to select the table "text_attribute".
0
 

Author Comment

by:didede
ID: 1497464
For the remark about the my comment on the wrong SQL syntaxe :
When i have posted this comment, i didnt see the first answer from vspeter !!
I leave in paris, may be the time difference between time zones
Thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question