|
|
 |
RE: FN-FORUM: SQL ERROR - HELP REQUIRED PLEASE
date posted 8th January 2004 15:27
Hi Pam
cmdFT.CommandText = "SELECT MAX(tblOrder.orderBasketID) AS Maximum
FROM....."
I think. Fairly sure Maximum is a reserved word in which case IIRC you
need to use [] around it, ie
SELECT MAX(tblOrder.orderBasketID) AS [Maximum] FROM.....
I think, my JET SQL is rather rusty.
Norman
-----Original Message-----
From: [EMAIL REMOVED] [EMAIL REMOVED] On Behalf Of PAMELA
WHITTAKER
Sent: 08 January 2004 15:51
To: FN-FORUM / [EMAIL REMOVED]
Subject: Re: FN-FORUM: SQL ERROR - HELP REQUIRED PLEASE
Hi,
Doesn't the 'Maximum' in the following statement create a tempory
column?
Pam
cmdFT.CommandText = "SELECT 'Maximum' = MAX(tblOrder.orderBasketID) FROM
----- Original Message -----
From: "Norman Beresford" [EMAIL REMOVED]
To: [EMAIL REMOVED]
Sent: Thursday, January 08, 2004 3:41 PM
Subject: RE: FN-FORUM: SQL ERROR - HELP REQUIRED PLEASE
>
> Hi Pam
>
> I'd guess that there isn't a column called Maximum in the return
> datareader.
>
> Norman
>
> -----Original Message-----
> From: [EMAIL REMOVED] [EMAIL REMOVED] On Behalf Of
> PAMELA WHITTAKER
> Sent: 08 January 2004 15:37
> To: FN-FORUM / [EMAIL REMOVED]
> Subject: FN-FORUM: SQL ERROR - HELP REQUIRED PLEASE
>
>
>
> Hi,
>
> I am getting the following error
>
>
>
> "Exception Details: System.IndexOutOfRangeException: Maximum"
>
> the line I am getting it on is Return drFT("Maximum")
>
> Could some one tell me what I have dobe wrong please
>
>
>
> Thanks
>
> Pam
>
>
>
>
> The .net function is
>
>
>
> Private Function _MaxBasketID() As Integer
>
> Dim connFT As New OleDbConnection(_ConnectionString)
>
> Dim cmdFT As New OleDbCommand
>
> cmdFT.Connection = connFT
>
> cmdFT.CommandType = CommandType.Text
>
> connFT.Open()
>
> cmdFT.CommandText = "SELECT 'Maximum' = MAX(tblOrder.orderBasketID)
> FROM tblOrder;"
>
> Dim drFT As OleDbDataReader
>
> drFT = cmdFT.ExecuteReader
>
> If drFT.Read Then
>
> Return drFT("Maximum")
>
> End If
>
> drFT.Close()
>
> connFT.Close()
>
> End Function
>
>
> --
> ** Get all the Freelance Work you Can Handle *
> The Web Design Business Kit will show you proven tactics
> and strategies for marketing your business, winning bids, managing
> projects and pricing your work. Free Shipping Worldwide. Read more &
get
> free chapters at: http://www.sitepoint.com/launch/b7c91e/3/4
>
> To advertise here: http://www.freelancers.net/advertising.html
>
>
> --
> ** Get all the Freelance Work you Can Handle *
> The Web Design Business Kit will show you proven tactics
> and strategies for marketing your business, winning bids,
> managing projects and pricing your work. Free Shipping Worldwide.
> Read more & get free chapters at:
http://www.sitepoint.com/launch/b7c91e/3/4
>
> To advertise here: http://www.freelancers.net/advertising.html
>
>
--
** Get all the Freelance Work you Can Handle *
The Web Design Business Kit will show you proven tactics
and strategies for marketing your business, winning bids, managing
projects and pricing your work. Free Shipping Worldwide. Read more & get
free chapters at: http://www.sitepoint.com/launch/b7c91e/3/4
To advertise here: http://www.freelancers.net/advertising.html
|
 |
|