ASP database issue

ASP database issue

am 04.06.2007 17:15:34 von John Peach

not sure if this is the right place to ask but, when i run the following
query in ASP i get the error

Microsoft OLE DB Provider for SQL Server error '80040e14'

Invalid column name '2 UK lighting turnover from Indoor lighting'.

/qbrowse/forms/New Starter Feedback Form.asp, line 65

where line 65 executed the following sql statement


INSERT INTO tblNewStarter ([FormName], [Name], [Company], [1 UK turnover
from lighting products £], [Percentage], [2 UK lighting turnover from Indoor
lighting], [2 UK lighting turnover from Outdoor Lighting], [2 UK lighting
turnover from Loose lamps], [3 Route to Market Wholesale - Stock], [3 Route
to Market Wholesale - Project], [3 Route to Market Direct / End User], [3
Route to Market Retail], [3 Route to Market Other], [3 Route to Market
(please specify)], [4 UK Headcount External Salespeople - Stock], [4 UK
Headcount External Salespeople - Project], [4 UK Headcount Internal
Salespeople - Stock], [4 UK Headcount Internal Salespeople - Project], [4 UK
Headcount Other Salespeople], [5 How many UK regional sales offices ?],
[Where ?], [6Lighting Schemes], [6a Products Manufactured in UK], [6a
Products Manufactured in Central Europe], [6a Products Manufactured in
Eastern Europe], [6a Products Manufactured in Far East], [6a Products
Manufactured in Other], [6a Products Manufactured in (Please specify)], [6b
For UK Market UK], [6b For UK Market Central Europe], [6b For UK Market
Eastern Europe], [6b For UK Market Far East], [6b For UK Market Other],
[7Preferred ballast type], [8Component Supplier], [9 Are products
distributed from a central point or are there outlying distribution
centres?], [Where?], [10Product Return Policy], [11Samples], [12 Is the
company able to provide a mock-up for a large project ?], [Is this provided
free of charge ?], [13Sponsorship], [14 What is the company spend on
entertainment?], [What form does this take ?], lastupdateddate) VALUES ('New
Starter Feedback Form','John Peach','Peas ltd
','','','','','','','','','','','','','','','','','','','',' ','','','','','','','','','','','','','','','','','','','',' ','',
'6/4/2007')

Can anyone advise why this won't run in ASp but runs without it in SQL
itself



Thanks in anticipation



John

Re: ASP database issue

am 04.06.2007 17:26:19 von reb01501

John Peach wrote:
> not sure if this is the right place to ask but, when i run the
> following query in ASP i get the error
>
> Microsoft OLE DB Provider for SQL Server error '80040e14'

What version of SQL Server is this?
>
> Invalid column name '2 UK lighting turnover from Indoor lighting'.

I suspect that using a numeric character as the first character in the
field name is causing the problem. IIRC, you should not have even been
allowed to do that.
From BOL:
a..
1.. The first character must be one of the following:
2.. A letter as defined by the Unicode Standard 2.0. The Unicode
definition of letters includes Latin characters a-z and A-Z, in addition
to letter characters from other languages.
a.. The _ (underscore), @ (at sign), or # (number sign) symbol.
Certain symbols at the beginning of an identifier have special meaning
in SQL Server. An identifier beginning with @ denotes a local variable
or parameter. An identifier beginning with # denotes a temporary table
or procedure. An identifier beginning with double number signs (##)
denotes a global temporary object.

Some Transact-SQL functions have names that start with double at signs
(@@). To avoid confusion with these functions, it is recommended that
you do not use names that start with @@.



--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Re: ASP database issue

am 04.06.2007 18:27:09 von John Peach

I took your advice and stripped out the illegal characters, but still get an
error :

Microsoft OLE DB Provider for SQL Server error '80040e14'

Invalid column name 'UK lighting turnover from Indoor lighting'.

/qbrowse/forms/New Starter Feedback Form.asp, line 71

INSERT INTO tblNewStarter ([FormName], [Name], [Company], [UK turnover from
lighting products £], [Percentage], [UK lighting turnover from Indoor
lighting], [UK lighting turnover from Outdoor Lighting], [UK lighting
turnover from Loose lamps], [Route to Market Wholesale - Stock], [Route to
Market Wholesale - Project], [Route to Market Direct / End User], [Route to
Market Retail], [Route to Market Other], [Route to Market (please specify)],
[UK Headcount External Salespeople - Stock], [UK Headcount External
Salespeople - Project], [UK Headcount Internal Salespeople - Stock], [UK
Headcount Internal Salespeople - Project], [UK Headcount Other Salespeople],
[How many UK regional sales offices ?], [Where ?], [Lighting Schemes], [a
Products Manufactured in UK], [a Products Manufactured in Central Europe],
[a Products Manufactured in Eastern Europe], [a Products Manufactured in Far
East], [a Products Manufactured in Other], [a Products Manufactured in
(Please specify)], [b For UK Market UK], [b For UK Market Central Europe],
[b For UK Market Eastern Europe], [b For UK Market Far East], [b For UK
Market Other], [Preferred ballast type], [Component Supplier], [Are products
distributed from a central point or are there outlying distribution
centres?], [Where?], [Product Return Policy], [Samples], [Is the company
able to provide a mock-up for a large project ?], [Is this provided free of
charge ?], [Sponsorship], [What is the company spend on entertainment?],
[What form does this take ?], lastupdateddate) VALUES ('New Starter Feedback
Form','John Peach','Pea Soup
Ltd','','','','','','','','','','','','','','','','','','',' ','','','','','','','','','','','','','','','','','','','',' ','','',
'6/4/2007')

Again the statement execute in SQL without an issue

Any further advise would be appreciated

Regards



John

"Bob Barrows [MVP]" wrote in message
news:u23g0yrpHHA.3644@TK2MSFTNGP02.phx.gbl...
> John Peach wrote:
>> not sure if this is the right place to ask but, when i run the
>> following query in ASP i get the error
>>
>> Microsoft OLE DB Provider for SQL Server error '80040e14'
>
> What version of SQL Server is this?
>>
>> Invalid column name '2 UK lighting turnover from Indoor lighting'.
>
> I suspect that using a numeric character as the first character in the
> field name is causing the problem. IIRC, you should not have even been
> allowed to do that.
> From BOL:
> a..
> 1.. The first character must be one of the following:
> 2.. A letter as defined by the Unicode Standard 2.0. The Unicode
> definition of letters includes Latin characters a-z and A-Z, in addition
> to letter characters from other languages.
> a.. The _ (underscore), @ (at sign), or # (number sign) symbol.
> Certain symbols at the beginning of an identifier have special meaning
> in SQL Server. An identifier beginning with @ denotes a local variable
> or parameter. An identifier beginning with # denotes a temporary table
> or procedure. An identifier beginning with double number signs (##)
> denotes a global temporary object.
>
> Some Transact-SQL functions have names that start with double at signs
> (@@). To avoid confusion with these functions, it is recommended that
> you do not use names that start with @@.
>
>
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>

Re: ASP database issue

am 04.06.2007 18:31:42 von John Blessing

"John Peach" wrote in message
news:46643d6c$0$31693$db0fefd9@news.zen.co.uk...
>I took your advice and stripped out the illegal characters, but still get
>an error :
>
> Microsoft OLE DB Provider for SQL Server error '80040e14'
>
> Invalid column name 'UK lighting turnover from Indoor lighting'.
>
> /qbrowse/forms/New Starter Feedback Form.asp, line 71
>
> INSERT INTO tblNewStarter ([FormName], [Name], [Company], [UK turnover
> from lighting products £], [Percentage], [UK lighting turnover from Indoor
> lighting], [UK lighting turnover from Outdoor Lighting], [UK lighting
> turnover from Loose lamps], [Route to Market Wholesale - Stock], [Route to
> Market Wholesale - Project], [Route to Market Direct / End User], [Route
> to Market Retail], [Route to Market Other], [Route to Market (please
> specify)], [UK Headcount External Salespeople - Stock], [UK Headcount
> External Salespeople - Project], [UK Headcount Internal Salespeople -
> Stock], [UK Headcount Internal Salespeople - Project], [UK Headcount Other
> Salespeople], [How many UK regional sales offices ?], [Where ?], [Lighting
> Schemes], [a Products Manufactured in UK], [a Products Manufactured in
> Central Europe], [a Products Manufactured in Eastern Europe], [a Products
> Manufactured in Far East], [a Products Manufactured in Other], [a Products
> Manufactured in (Please specify)], [b For UK Market UK], [b For UK Market
> Central Europe], [b For UK Market Eastern Europe], [b For UK Market Far
> East], [b For UK Market Other], [Preferred ballast type], [Component
> Supplier], [Are products distributed from a central point or are there
> outlying distribution centres?], [Where?], [Product Return Policy],
> [Samples], [Is the company able to provide a mock-up for a large project
> ?], [Is this provided free of charge ?], [Sponsorship], [What is the
> company spend on entertainment?], [What form does this take ?],
> lastupdateddate) VALUES ('New Starter Feedback Form','John Peach','Pea
> Soup
> Ltd','','','','','','','','','','','','','','','','','','',' ','','','','','','','','','','','','','','','','','','','',' ','','',
> '6/4/2007')
>
> Again the statement execute in SQL without an issue
>
> Any further advise would be appreciated
>


I would be v. wary of using any column names containing spaces or question
marks or even > say 25 chars. Some of your column names remind me of
Cobol - which must have been the most verbose language ever used. Ok,
**some** databases **might** allow it, but there is way too much legacy code
kicking around in most products that would have a fit as soon as it sees
those characters. Stick to a-z and _ is my advice.


--
John Blessing

http://www.LbeHelpdesk.com - Help Desk software priced to suit all
businesses
http://www.room-booking-software.com - Schedule rooms & equipment bookings
for your meeting/class over the web.
http://www.lbetoolbox.com - Remove Duplicates from MS Outlook, find/replace,
send newsletters

Re: ASP database issue

am 04.06.2007 18:33:14 von Jon Paal

it says "invalid coulmn name" so verify if spelling in column name exactly matches name in sql statement. Also check spaces which
may not match.




"John Peach" wrote in message news:46642ca1$0$5872$da0feed9@news.zen.co.uk...
> not sure if this is the right place to ask but, when i run the following query in ASP i get the error
>
> Microsoft OLE DB Provider for SQL Server error '80040e14'
>
> Invalid column name '2 UK lighting turnover from Indoor lighting'.
>
> /qbrowse/forms/New Starter Feedback Form.asp, line 65
>
> where line 65 executed the following sql statement
>
>
> INSERT INTO tblNewStarter ([FormName], [Name], [Company], [1 UK turnover from lighting products £], [Percentage], [2 UK lighting
> turnover from Indoor lighting], [2 UK lighting turnover from Outdoor Lighting], [2 UK lighting turnover from Loose lamps], [3
> Route to Market Wholesale - Stock], [3 Route to Market Wholesale - Project], [3 Route to Market Direct / End User], [3 Route to
> Market Retail], [3 Route to Market Other], [3 Route to Market (please specify)], [4 UK Headcount External Salespeople - Stock], [4
> UK Headcount External Salespeople - Project], [4 UK Headcount Internal Salespeople - Stock], [4 UK Headcount Internal
> Salespeople - Project], [4 UK Headcount Other Salespeople], [5 How many UK regional sales offices ?], [Where ?], [6Lighting
> Schemes], [6a Products Manufactured in UK], [6a Products Manufactured in Central Europe], [6a Products Manufactured in Eastern
> Europe], [6a Products Manufactured in Far East], [6a Products Manufactured in Other], [6a Products Manufactured in (Please
> specify)], [6b For UK Market UK], [6b For UK Market Central Europe], [6b For UK Market Eastern Europe], [6b For UK Market Far
> East], [6b For UK Market Other], [7Preferred ballast type], [8Component Supplier], [9 Are products distributed from a central
> point or are there outlying distribution centres?], [Where?], [10Product Return Policy], [11Samples], [12 Is the company able to
> provide a mock-up for a large project ?], [Is this provided free of charge ?], [13Sponsorship], [14 What is the company spend on
> entertainment?], [What form does this take ?], lastupdateddate) VALUES ('New Starter Feedback Form','John Peach','Peas ltd
> ','','','','','','','','','','','','','','','','','','','',' ','','','','','','','','','','','','','','','','','','','',' ','',
> '6/4/2007')
>
> Can anyone advise why this won't run in ASp but runs without it in SQL itself
>
>
>
> Thanks in anticipation
>
>
>
> John
>
>

Re: ASP database issue

am 04.06.2007 19:37:00 von reb01501

John Peach wrote:
> I took your advice and stripped out the illegal characters, but still
> get an error :
>

By "stripping out", do you mean you changed the names of the fields in
the database? or did you merely remove the characters from your sql
statement?

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Re: ASP database issue

am 04.06.2007 19:55:34 von John Peach

LOL, no the fields in the database match the names in the SQL statement, as
stated the SQL statement runs prefectly from the Servera and the record gets
inserted into the database, just will not run from ASP

Regards

John

"Bob Barrows [MVP]" wrote in message
news:OhQB27spHHA.1240@TK2MSFTNGP04.phx.gbl...
> John Peach wrote:
>> I took your advice and stripped out the illegal characters, but still
>> get an error :
>>
>
> By "stripping out", do you mean you changed the names of the fields in
> the database? or did you merely remove the characters from your sql
> statement?
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>

Re: ASP database issue

am 04.06.2007 20:18:22 von reb01501

I know this could be construed as dodging the question, but I have to
ask: is there a reason you have not encapsulated this long sql statement
into a stored procedure?

I'd like to try to reproduce your problem, so can you let me know what
version of SQL Server you are using? Also, can you verify if the
following statement reproduces the problem:

INSERT INTO tblNewStarter ([FormName], [Name], [Company],
[UK turnover from lighting products £], [Percentage],
[UK lighting turnover from Indoor lighting])
VALUES ('New Starter Feedback Form',
'John Peach','Pea Soup Ltd','','','')

John Peach wrote:
> LOL, no the fields in the database match the names in the SQL
> statement, as stated the SQL statement runs prefectly from the
> Servera and the record gets inserted into the database, just will not
> run from ASP
>
> Regards
>
> John
>
> "Bob Barrows [MVP]" wrote in message
> news:OhQB27spHHA.1240@TK2MSFTNGP04.phx.gbl...
>> John Peach wrote:
>>> I took your advice and stripped out the illegal characters, but
>>> still get an error :
>>>
>>
>> By "stripping out", do you mean you changed the names of the fields
>> in the database? or did you merely remove the characters from your
>> sql statement?
>>


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Re: ASP database issue

am 05.06.2007 08:59:18 von John Peach

The insert statement you put forward ran without issue

Will go the stored procedure route if i can't get this sql statement to work

Running on SQL 2000

Regards

John

"Bob Barrows [MVP]" wrote in message
news:%23TzW9StpHHA.1244@TK2MSFTNGP04.phx.gbl...
> I know this could be construed as dodging the question, but I have to
> ask: is there a reason you have not encapsulated this long sql statement
> into a stored procedure?
>
> I'd like to try to reproduce your problem, so can you let me know what
> version of SQL Server you are using? Also, can you verify if the
> following statement reproduces the problem:
>
> INSERT INTO tblNewStarter ([FormName], [Name], [Company],
> [UK turnover from lighting products £], [Percentage],
> [UK lighting turnover from Indoor lighting])
> VALUES ('New Starter Feedback Form',
> 'John Peach','Pea Soup Ltd','','','')
>
> John Peach wrote:
>> LOL, no the fields in the database match the names in the SQL
>> statement, as stated the SQL statement runs prefectly from the
>> Servera and the record gets inserted into the database, just will not
>> run from ASP
>>
>> Regards
>>
>> John
>>
>> "Bob Barrows [MVP]" wrote in message
>> news:OhQB27spHHA.1240@TK2MSFTNGP04.phx.gbl...
>>> John Peach wrote:
>>>> I took your advice and stripped out the illegal characters, but
>>>> still get an error :
>>>>
>>>
>>> By "stripping out", do you mean you changed the names of the fields
>>> in the database? or did you merely remove the characters from your
>>> sql statement?
>>>
>
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>

Re: ASP database issue

am 05.06.2007 12:37:54 von reb01501

John Peach wrote:
> The insert statement you put forward ran without issue
>

Really? So that means the problem lies elsewhere. Add fields in
one-at-a-time until you discover the actual culprit.

> Will go the stored procedure route if i can't get this sql statement
> to work
> Running on SQL 2000

Frankly, I would stop wasting time and convert it to a stored procedure
which can easily be executed from asp. Aee:
http://groups.google.com/group/microsoft.public.inetserver.a sp.general/msg/5d3c9d4409dc1701?hl=en&

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Re: ASP database issue

am 06.06.2007 18:36:14 von John Peach

Thanks for the advice, eventually went forthe route of a Stored procedure
and all is working well now

Regards

John

"Bob Barrows [MVP]" wrote in message
news:uDkuD21pHHA.3312@TK2MSFTNGP05.phx.gbl...
> John Peach wrote:
>> The insert statement you put forward ran without issue
>>
>
> Really? So that means the problem lies elsewhere. Add fields in
> one-at-a-time until you discover the actual culprit.
>
>> Will go the stored procedure route if i can't get this sql statement
>> to work
>> Running on SQL 2000
>
> Frankly, I would stop wasting time and convert it to a stored procedure
> which can easily be executed from asp. Aee:
> http://groups.google.com/group/microsoft.public.inetserver.a sp.general/msg/5d3c9d4409dc1701?hl=en&
>
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>