Solved

Join with VB5, ODBC and SYBASE

Posted on 1998-11-05
6
335 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
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…
Suggested Courses
Course of the Month8 days, 11 hours left to enroll

615 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