Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Join with VB5, ODBC and SYBASE

Posted on 1998-11-05
6
Medium Priority
?
346 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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 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…
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…

688 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