Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 13th, 2004, 04:18 PM
Authorized User
 
Join Date: May 2004
Location: London, London, United Kingdom.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Seb_soum
Default INSERT & SELECT FROM....? No idea

hi guys

I need to insert seom details into a Access DB. thats no problem. I do need to have a drop down list showing usernames from another table. The value from the drop down is passed onto the other table. How do I do this? Can I have 2 SQL statements on 1 page?
EG. SELECT * FROM Users & INSERT INTO Main......etc
Reply With Quote
  #2 (permalink)  
Old May 13th, 2004, 05:46 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

You can have two sql statements. Let me see if I understand; first you select the users and use the drop down box, then when the user selects an option, you want to then insert information into another table?

You can have 2 statements sure, the select is a select into a recordset, and to do the insert you can do connection.execute(SQL).

Brian

Brian
Reply With Quote
  #3 (permalink)  
Old May 14th, 2004, 05:35 AM
Authorized User
 
Join Date: May 2004
Location: London, London, United Kingdom.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Seb_soum
Default

Could you give me an axample.....sorry, I've tried to find this kind of code on the net, but nothing so far......I'm pretty limited in ASP.

Any help you could give me would be appreciated
Reply With Quote
  #4 (permalink)  
Old May 14th, 2004, 07:06 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open strConnectionString
set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open ("select * from Users", objConn)

do while (not objRS.EOF)
  objConn.Execute("insert into Main (userID, page) values ('" & objRS("UserID") & "', '" & Request.ServerVariables("SCRIPT_NAME") & "')")
  objRS.MoveNext
loop

Something like that. Although what are you trying to do?
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
insert into....select problem timbal25 SQL Server 2005 1 October 24th, 2007 08:28 PM
Brilliant idea, no idea how! imaginitive-idea-guy Ajax 9 January 14th, 2007 05:32 AM
SELECT/ORDER/INSERT Stuart Stalker SQL Server DTS 1 July 24th, 2005 01:00 AM
idea of report & DataSet melvik Crystal Reports 1 May 18th, 2004 02:10 AM



All times are GMT -4. The time now is 12:48 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.