473,386 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

SQL aliases in Visual C++ 6.0

I'm making my first attempt to put embedded
SQL in a visual C++ application and I'm
having trouble getting aliases to work.
If I try the following SQL query on MS SQL 7.0
it works fine.

SELECT MTI.Mesh_Window_ID Window_ID FROM
Mesh_Transform_Indices MTI
WHERE MTI.Mesh_Window_ID = 200

If I run the same query from visual C++ 6.0
clicking on a data view and the appropriate
database and choosing 'run' from the right
mouse button menu, I get the following error :

Syntax error (missing operator) in query expression 'MTI.Mesh_Window_ID Window_ID'

if I remove the Window_ID alias, thus

SELECT MTI.Mesh_Window_ID FROM
Mesh_Transform_Indices MTI
WHERE MTI.Mesh_Window_ID = 200

it runs. If I embed this query in C++ and try it using
CDaoQueryDef, CDaoRecordset I get the same behaviour.

As far as I know this is standard SQL. Is there some
limitation on SQL when putting it in Visual C++ code ?

Thanks for any advice

Kevin
Jul 22 '05 #1
5 1736
On 4 Feb 2004 18:11:57 -0800, bw*****@hotmail.com (Kevin) wrote in
comp.lang.c++:
I'm making my first attempt to put embedded
SQL in a visual C++ application and I'm
having trouble getting aliases to work.
If I try the following SQL query on MS SQL 7.0
it works fine.

SELECT MTI.Mesh_Window_ID Window_ID FROM
Mesh_Transform_Indices MTI
WHERE MTI.Mesh_Window_ID = 200


[snip]

Sorry, you're off-topic here. The C++ language standard does not
define or support "embedded SQL", and the stuff you wrote above is
just a syntax error in C++.

There should be support groups on Microsoft's server
msnews.microsoft.com in the news:microsoft.public.* family.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Jul 22 '05 #2
"Kevin" <bw*****@hotmail.com> wrote in message
news:bc**************************@posting.google.c om...
<snip>
SELECT MTI.Mesh_Window_ID Window_ID FROM
Mesh_Transform_Indices MTI
WHERE MTI.Mesh_Window_ID = 200 <snip> As far as I know this is standard SQL. Is there some
limitation on SQL when putting it in Visual C++ code ?

Thanks for any advice

Kevin


Have you tried 'SELECT MTI.Mesh_Window_ID AS Window_ID'?
Whether this works or not, your post is off topic here.
Try the microsoft.public range of newsgroups for a VC++ one, or a group
specific to your database engine.
Jul 22 '05 #3
I don't really want to get into an argument with
the topic police. I know the SQL is correct according
to the SQL standard and it works in the MS SQL query
analyser. I know that the C++ that sends the query to
the database correctly, because I can do
other queries which don't include aliases with the
same code. So I don't need any help from SQL experts.

My question is for users of the Visual C++ environment
which does support SQL. It has a data view feature and
it allows you to run SQL scripts directly. All I want
to know is if any one else has had difficulty with
aliases or there are any differences in syntax which
apply when running these scripts from the Visual
C++ program interface. For example, I have noticed that
some sample code uses square brackets on field names.

The error that gets produced refers to the exception
message that is returned when the database rejects the
script.

I will try the other group you suggested anyway though.

My question is basically f
Jack Klein <ja*******@spamcop.net> wrote in message news:<8k********************************@4ax.com>. ..
On 4 Feb 2004 18:11:57 -0800, bw*****@hotmail.com (Kevin) wrote in
comp.lang.c++:
I'm making my first attempt to put embedded
SQL in a visual C++ application and I'm
having trouble getting aliases to work.
If I try the following SQL query on MS SQL 7.0
it works fine.

SELECT MTI.Mesh_Window_ID Window_ID FROM
Mesh_Transform_Indices MTI
WHERE MTI.Mesh_Window_ID = 200


[snip]

Sorry, you're off-topic here. The C++ language standard does not
define or support "embedded SQL", and the stuff you wrote above is
just a syntax error in C++.

There should be support groups on Microsoft's server
msnews.microsoft.com in the news:microsoft.public.* family.

Jul 22 '05 #4
adding 'AS'....Thanks, that did the trick.

I'll post it her for the benefit of those who come looking
for an answer to the same problem.

Is it me or is the general level of documentation for putting
SQL in Visual C++ a bit weak ?

"GrOrH" <unavailable> wrote in message news:<40**********@nnrp1.news.uk.psi.net>...
"Kevin" <bw*****@hotmail.com> wrote in message
news:bc**************************@posting.google.c om...
<snip>
SELECT MTI.Mesh_Window_ID Window_ID FROM
Mesh_Transform_Indices MTI
WHERE MTI.Mesh_Window_ID = 200

<snip>
As far as I know this is standard SQL. Is there some
limitation on SQL when putting it in Visual C++ code ?

Thanks for any advice

Kevin


Have you tried 'SELECT MTI.Mesh_Window_ID AS Window_ID'?
Whether this works or not, your post is off topic here.
Try the microsoft.public range of newsgroups for a VC++ one, or a group
specific to your database engine.

Jul 22 '05 #5
On 5 Feb 2004 10:30:33 -0800, bw*****@hotmail.com (Kevin) wrote in
comp.lang.c++:

Top-posting will make you about as many friends here as arguing that
you should be welcomed for off-topic questions.
I don't really want to get into an argument with
the topic police. I know the SQL is correct according
to the SQL standard and it works in the MS SQL query
analyser. I know that the C++ that sends the query to
the database correctly, because I can do
other queries which don't include aliases with the
same code. So I don't need any help from SQL experts.

My question is for users of the Visual C++ environment


[snip]

The Visual C++ environment is just as off-topic here as is SQL.
Neither of them is part of the C++ language.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Jul 22 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mike Ash | last post by:
I recently had a project dropped into my lap that is written in JSP running on Apache/Resin. A previous version of the application is already running and configured on the production server, but...
0
by: Andrew | last post by:
With command-line interface ( 3.23.37, UNIX Socket ) all is well with column aliasing. However, column aliases disappear in Excel, over ODBC, when there are multiple (joined) tables in the query. ...
0
by: Krzysiek | last post by:
Hi all, I have an issue with QSYS\QADBXREF file - it keeps aliases on tables. I take care of an application that works on many places (servers) and on one of them it's not possible to create...
22
by: mp | last post by:
i have a python program which attempts to call 'cls' but fails: sh: line 1: cls: command not found i tried creating an alias from cls to clear in .profile, .cshrc, and /etc/profile, but none...
15
by: jacob navia | last post by:
Recently, we had a very heated thread about GC with the usual arguments (for, cons, etc) being exchanged. In one of those threads, we came into the realloc problem. What is the realloc...
22
by: Daniel Rucareanu | last post by:
I have the following script: function Test(){} Test.F = function(){} Test.F.FF = function(){} Test.F.FF.FFF = function(){} Test.F.FF.FFF.FFFF = function(){} //var alias = function(){}; var...
11
by: Chris Thomasson | last post by:
I was thinking of how I was going to create a robust versioning system in Standard C++ for my library and was wondering exactly what the point of a namespace alias is? The seem like a rather...
1
by: drexcol | last post by:
I am a php newbie and am trying to write a script that will direct visitors to specific pages on my website based on which of several url’s they have entered (all are aliases of the main website)....
6
by: dom.k.black | last post by:
Is it still common practice to use type aliases (INT, PCHAR etc). It looks ugly and breaks the syntax highlighting, are there any advantages these days (MSVC++6.0 and later)? I could understand...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.