Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Data Connectivity
Message Icon Topic: Error in SQL Connection Post Reply Post New Topic
Author Message
jjcyeshua
Newbie
Newbie
Avatar

Joined: 22 Mar 2007
Location: United States
Online Status: Offline
Posts: 30
Quote jjcyeshua Replybullet Topic: Error in SQL Connection
    Posted: 30 Aug 2007 at 3:49pm
Hi! guys,
 
Need help.. I connected ODBC so that i could write sql commands, but i get this error... any suggestion on how i could make this go away?
 
Error in compiling SQL Expression:
Database Connector Error: '42000:[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'select'.[Database Vendor Code:156]'.
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 30 Aug 2007 at 4:53pm
This is a pretty generic error message. Sounds like a typical SQL syntax error. I would copy the SQL into the Query Analyzer to get a better error message.

Edited by BrianBischof - 30 Aug 2007 at 4:54pm
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
jjcyeshua
Newbie
Newbie
Avatar

Joined: 22 Mar 2007
Location: United States
Online Status: Offline
Posts: 30
Quote jjcyeshua Replybullet Posted: 30 Aug 2007 at 4:59pm
Not sure what you mean run it using query analyzer. but the sql command that i wrote is working under sql server. It was just a simply select * , to make sure at its working. not entirely sure if this helps or even answer your comment... SOrry
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 30 Aug 2007 at 5:58pm
Well, that is what I meant. The error message is too generic to find out what is wrong. I thought maybe you had a SQL syntax error. Are you sure that CR has permission to access all the necessary tables? 
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
jjcyeshua
Newbie
Newbie
Avatar

Joined: 22 Mar 2007
Location: United States
Online Status: Offline
Posts: 30
Quote jjcyeshua Replybullet Posted: 30 Aug 2007 at 6:02pm
Yes, it can access all the tables. Whenever i drag and drop any tables into the report itself, it works fine. The tables shows as well as the data. Not sure if i'm typing it correctly or if CR uses different syntax. Any ideas why?
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 30 Aug 2007 at 6:13pm
Crystal will use a different syntax for its own queries (use the View SQL Query option to see), but the SQL you enter is passed to the server untouched.

Also, I would create a new report with a very simple query in the Command object. Just "SELECT * FROM table" and see if it takes it. If so, add on incrementally from there to see what causes the error.

Can you post the Command object's SQL here just for kicks?

Edited by BrianBischof - 30 Aug 2007 at 6:16pm
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 30 Aug 2007 at 6:15pm
There is a tool that gets installed with MS SQL Server called SQL Profiler. You can use it to see the query that CR passes to SQL and see if something funny is happening behind the scenes.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
jjcyeshua
Newbie
Newbie
Avatar

Joined: 22 Mar 2007
Location: United States
Online Status: Offline
Posts: 30
Quote jjcyeshua Replybullet Posted: 31 Aug 2007 at 2:21pm

I think i may have posted my question in correctly (sorry again). Where am having problem is creating sql expression not sql command. When i tried creating an sql command, it works perfectly, but when i just create sql expressions thats when i get the error message.. Sorry for the confusion... and whenever I create an sql command. the option of creating an sql expression disappear..  thanks for the help again

IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 01 Sep 2007 at 1:49am
Oh. I see. Well, at least it makes more sense now.... Creating SQL Expressions is dependent upon your database and the database driver. If the SQL Expression isn't listed, then your driver doesn't support. Try using the ODBC driver for the database. This has better chance of supporting it.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.000 seconds.