Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Old 02-28-2006, 03:37 PM HELP!!!
Junior Talker

Posts: 2
Trades: 0
Hi Guys, I'm very new to ASP and am having a annoying problem. Can anyone help.

Why isn't this working?

The DSN is correct and there is a table in my Db called 'april'.

<%
dim str_month
str_month = "april"

set oRSt=Server.CreateObject ("ADODB.recordset")
sqltext="SELECT * FROM '%" & str_month & "%' WHERE ID=2"

oRSt.open sqltext, "DSN=nt5792-calendar"
%>

getting an error of:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in query. Incomplete query clause.

/bcintra/pages/calendar/searchc.asp, line 20


Thanks in advance.
Lewis is offline
Reply With Quote
View Public Profile Visit Lewis's homepage!
 
 
Register now for full access!
Old 03-01-2006, 05:53 AM Re: HELP!!!
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
Try:

sqltext = "SELECT * FROM " & str_month & " WHERE ID = 2"

You can't put table names in quotes, and you can't use wildcards (*, %) for table names either.

Have you got a different table for every month? That seems like an illogical database structure... specially if all the tables contain the same type of data.
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 03-01-2006, 08:43 AM Re: HELP!!!
Junior Talker

Posts: 2
Trades: 0
It worked!! Minaki, I can't thank you enough, you really got me out of a tight spot. Much appreciated.
Lewis is offline
Reply With Quote
View Public Profile Visit Lewis's homepage!
 
Reply     « Reply to HELP!!!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.31160 seconds with 12 queries