Solved

Join with VB5, ODBC and SYBASE

Posted on 1998-11-05
6
277 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
  • 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now