Solved

Join with VB5, ODBC and SYBASE

Posted on 1998-11-05
6
313 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

820 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