MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old September 6th, 2003, 10:56 AM
TurboTronix TurboTronix is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 2 TurboTronix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ASP MySql problem

Hi,

My code used to work since it started showing me this:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[MySQL][ODBC 3.51 Driver][mysqld-4.0.14-nt]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
/Auction/bidmenu.asp, line 97

In the bidmeny.asp code I have this:

90 Set my_conn = Server.CreateObject("ADODB.Connection")
91 Set rsItem = Server.CreateObject("ADODB.Recordset")
92 my_conn.Open "DSN=mysql_dns" ' Data source name
93
94 Dim rsItem, strItemName, strDescription, strPerson
95 strSQL = "SELECT * FROM Item WHERE ItemID =" & Request("Item")
96
97 Set rsItem = my_conn.Execute(strSQL)

I can't seem to fix it...does anyone have a clue what this could be?

Reply With Quote
  #2  
Old September 6th, 2003, 05:02 PM
rdoekes rdoekes is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Strasbourg, France
Posts: 181 rdoekes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 20 sec
Reputation Power: 7
Send a message via AIM to rdoekes Send a message via Yahoo to rdoekes
does the Request("Item") render any result?

On line 96 do a Response.Write strSQL to see if the sql is correct. You can even test that statement in the mySql command prompt, to see if you have errors.

Judging by the error message, there is something wrong with the sql statement.

Another suggestion: complete the sql statement with a semicolon.
Code:
95 strSQL = "SELECT * FROM Item WHERE ItemID =" & Request("Item") & ";"


Hope this helps,
__________________
- Rogier Doekes

Reply With Quote
  #3  
Old September 6th, 2003, 05:13 PM
TurboTronix TurboTronix is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 2 TurboTronix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I added a static value instead of Request("Item") and it worked but then gave me the same error for another line where I also have a .execute(sql) command. Something is wrong with that command, that MySql cannot resolve or something.

Maybe I need some specific version of MySql or something to make it work...Because it always gives me an error on lines where I used ".execute" command. The SQL Query is good, I tested it in MySQL.

Reply With Quote
  #4  
Old September 6th, 2003, 07:50 PM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 7
Try
Code:
strSQL = "SELECT * FROM Item WHERE ItemID ='" & Request("Item") & "';"
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
  #5  
Old August 23rd, 2005, 12:55 PM
mekotelly mekotelly is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 3 mekotelly User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 51 m 38 sec
Reputation Power: 0
hi wiz need your help

Quote:
Originally Posted by rdoekes
does the Request("Item") render any result?

On line 96 do a Response.Write strSQL to see if the sql is correct. You can even test that statement in the mySql command prompt, to see if you have errors.

Judging by the error message, there is something wrong with the sql statement.

Another suggestion: complete the sql statement with a semicolon.
Code:
95 strSQL = "SELECT * FROM Item WHERE ItemID =" & Request("Item") & ";"


Hope this helps,




hello im ed from kenya.just starting to use asp and mysql. got this syntax error could you please help me. below is the error and the code


--------------------------------------------------------------------------------

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[MySQL][ODBC 3.51 Driver][mysqld-4.1.1a-alpha]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'productid<>178 order by name' at line 1

/shop1/admin/product.asp, line 42


--------------------------------------------------------------------------------

this is the vbscript

set rscatlist=db.execute("select name, productid from products where catcode=" & rsprod("catcode") & "and productid<>" & valid_sql(productid) & " order by name")


--------------------------------------------------------------------------------

this is the other error

ADODB.Field error '80020009'

Either BOF or EOF is True, or the current record has been deleted; the operation requested by the application requires a current record.

?


<%
'Display a featured product

Set rsprod = Server.CreateObject("ADODB.Recordset")
rsprod.Open "select * from products where featured=true" , StrConn, adOpenStatic, adLockReadOnly
rmax=rsprod.recordcount

if not rsprod.eof then
t=Timer
Randomize t
rnum = Int(RND * rmax)
rsprod.move rnum


'set rsprod=db.execute("select * from products")

if not rsprod.eof then
%>
<%= rsprod("name") %>

<%= rsprod("featimage") %>
<% if rsprod("saleprice")="" or rsprod("saleprice")=0 then %>
<b>Price: <%= cursymbol & formatnumber(rsprod("price")) %>
<% else %>
<strike>Price: <%= cursymbol & formatnumber(rsprod("price")) %>
Sale: <%= cursymbol & formatnumber(rsprod("saleprice")) %>&nbsp;<img src="images/gifs/saletag.gif">
<% end if %>



<%= rsprod("shortdesc") %>
<% end if %>

<a href="addprod.asp?productid=<%= rsprod("productid")%>"><img src="images/gifs/add2cart.gif" border="0"></a>
<%
end if
db.Close
Set db = Nothing
%>


--------------------------------------------------------------------------------

your help will be appreciated my email is fyonza@yahoo.com

Reply With Quote
  #6  
Old August 23rd, 2005, 12:59 PM
mekotelly mekotelly is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 3 mekotelly User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 51 m 38 sec
Reputation Power: 0
hi tronix got a similar error to your earlier

Quote:
Originally Posted by TurboTronix
Hi,

My code used to work since it started showing me this:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[MySQL][ODBC 3.51 Driver][mysqld-4.0.14-nt]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
/Auction/bidmenu.asp, line 97

In the bidmeny.asp code I have this:

90 Set my_conn = Server.CreateObject("ADODB.Connection")
91 Set rsItem = Server.CreateObject("ADODB.Recordset")
92 my_conn.Open "DSN=mysql_dns" ' Data source name
93
94 Dim rsItem, strItemName, strDescription, strPerson
95 strSQL = "SELECT * FROM Item WHERE ItemID =" & Request("Item")
96
97 Set rsItem = my_conn.Execute(strSQL)

I can't seem to fix it...does anyone have a clue what this could be?



hello im ed from kenya.just starting to use mysql. got this syntax error could you please help me. below is the error and the code


--------------------------------------------------------------------------------

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[MySQL][ODBC 3.51 Driver][mysqld-4.1.1a-alpha]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'productid<>178 order by name' at line 1

/shop1/admin/product.asp, line 42


--------------------------------------------------------------------------------

this is the vbscript

set rscatlist=db.execute("select name, productid from products where catcode=" & rsprod("catcode") & "and productid<>" & valid_sql(productid) & " order by name")


--------------------------------------------------------------------------------

thisistheothererror

ADODB.Field error '80020009'

Either BOF or EOF is True, or the current record has been deleted; the operation requested by the application requires a current record.

?


<%
'Display a featured product

Set rsprod = Server.CreateObject("ADODB.Recordset")
rsprod.Open "select * from products where featured=true" , StrConn, adOpenStatic, adLockReadOnly
rmax=rsprod.recordcount

if not rsprod.eof then
t=Timer
Randomize t
rnum = Int(RND * rmax)
rsprod.move rnum


'set rsprod=db.execute("select * from products")

if not rsprod.eof then
%>
<%= rsprod("name") %>

<%= rsprod("featimage") %>
<% if rsprod("saleprice")="" or rsprod("saleprice")=0 then %>
<b>Price: <%= cursymbol & formatnumber(rsprod("price")) %>
<% else %>
<strike>Price: <%= cursymbol & formatnumber(rsprod("price")) %>
Sale: <%= cursymbol & formatnumber(rsprod("saleprice")) %>&nbsp;<img src="images/gifs/saletag.gif">
<% end if %>



<%= rsprod("shortdesc") %>
<% end if %>

<a href="addprod.asp?productid=<%= rsprod("productid")%>"><img src="images/gifs/add2cart.gif" border="0"></a>
<%
end if
db.Close
Set db = Nothing
%>


--------------------------------------------------------------------------------

your help will be appreciated my email is fyonza@yahoo.com

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > ASP MySql problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT