Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > ASP database issue

Reply
Thread Tools

ASP database issue

 
 
John Peach
Guest
Posts: n/a
 
      06-04-2007
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


 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      06-04-2007
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.


 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      06-04-2007
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.


 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      06-04-2007
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]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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.


 
Reply With Quote
 
John Peach
Guest
Posts: n/a
 
      06-05-2007
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]" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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]" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> 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.
>
>



 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      06-05-2007
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/micro...9dc1701?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"


 
Reply With Quote
 
John Peach
Guest
Posts: n/a
 
      06-06-2007
Thanks for the advice, eventually went forthe route of a Stored procedure
and all is working well now

Regards

John

"Bob Barrows [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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/micro...9dc1701?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"
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
exporting an excel file from database; making changes to excel file and updating the database by importing it back Luis Esteban Valencia ASP .Net 1 01-12-2005 12:28 AM
Re: Software Developer to transcribe Oracle database into Access database Fluker MCSD 0 07-09-2003 01:20 PM
Re: Software Developer to transcribe Oracle database into Access database Guy Cox MCSD 1 07-09-2003 08:07 AM



Advertisments