Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 26th, 2004, 03:21 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Could you post the part of your ASP code that uses the emp_id? Let me see if I could catch up something from there.

_________________________
-Vijay G
Strive for Perfection
 
Old May 26th, 2004, 03:26 PM
Authorized User
 
Join Date: Jan 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Code

Set DataConn = Server.CreateObject("ADODB.Connection")
DataConn.Open "Main"
SQLStmt = "SELECT * FROM personnel where employee ='" & emp & "'"
Set RS = DataConn.Execute(SQLStmt)
Response.write "SELECT * FROM personnel where employee ='" & emp & "' <br>"
Response.write rs("title") & "<br>"
Response.write rs("code") & "<br>"
Response.write rs("employee") & "<br>"
Response.write rs("rank") & "<br>"
Response.write rs("telephone") & "<br>"
Response.write rs("room") & "<br>"
Response.write rs("mail") & "<br>"
'Response.Write rs("emp_id") & "<br>"

Output

SELECT * FROM personnel where employee ='Randy Lightle'
Supervisory Budget Analyst
811
Randy Lightle
01
696-6837
1007
mailto:[email protected]
SELECT * FROM personnel where employee ='Randy Lightle'

I commented out the response.write rs("emp_id") because it throws my error.
 
Old May 26th, 2004, 03:30 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Is emp_id a column name? And how was it set up? Char, Number, etc.

 
Old May 26th, 2004, 03:37 PM
Authorized User
 
Join Date: Jan 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

emp_id is a column name, yes. It is an AutoNumber
 
Old May 26th, 2004, 03:39 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

SQLStmt = "SELECT [emp_id] FROM personnel where employee ='" & emp & "'"
Set RS = DataConn.Execute(SQLStmt)
Response.write SQLStmt & "<br>"
Response.Write rs("[emp_id]") & "<br>"

Can you please let me know what the above code gives as output?

_________________________
-Vijay G
Strive for Perfection
 
Old May 26th, 2004, 03:42 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Sorry, Please take out the [] from the following line, that was pasted by mistake.

Response.Write rs("[emp_id]") & "<br>"


_________________________
-Vijay G
Strive for Perfection
 
Old May 26th, 2004, 03:49 PM
Authorized User
 
Join Date: Jan 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Too few parameters. Expected 1.

This blows up on the execute line. It doesn't recognize the emp_id column.
 
Old May 26th, 2004, 03:50 PM
Authorized User
 
Join Date: Jan 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Too few parameters. Expected 1.

It blows up on the execute line. It's still not seeing the emp_id column
 
Old May 26th, 2004, 03:56 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

http://support.microsoft.com/default...b;en-us;216425

Please see this.

Quote:
quote:CAUSE
This error occurs only with Microsoft Access when one of the column names specified in a select statement does not exist in the table being queried.
Is that Access 2000? What is the connection that you are using?

DataConn.Open "Main"
Can you explain on this, what "Main" holds there?

_________________________
-Vijay G
Strive for Perfection
 
Old May 26th, 2004, 04:14 PM
Authorized User
 
Join Date: Jan 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, I just was able to add a test record to the table as long as I don't include the emp_id field, and it appeared in my query when I then tried to select it. But it does not appear in the access database. So apparently, the access database I'm looking at is not the one designated by "main" in my connection string. So I'm sorry for the trouble. But you've definitly helped me figure this out.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Update problem aceaceace Visual Basic 2005 Basics 6 February 21st, 2007 10:25 PM
Update problem filipczako ADO.NET 6 December 15th, 2005 11:58 AM
Update Problem skwilliams Classic ASP Databases 0 December 1st, 2005 11:02 AM
update problem lamdog ASP.NET 1.0 and 1.1 Basics 1 March 15th, 2005 11:59 PM
Update problem acko SQL Server 2000 3 June 29th, 2004 01:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.