Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » INSERT info from table1 to table2
Closed Thread
Old 06-09-2004, 04:05 PM   #1 (permalink)
 
Newb Techie

Join Date: Jun 2004

Posts: 10

techthis

Exclamation INSERT info from table1 to table2

hi...i've been trying to get my code to work for awhile...i can't seem to find the problem...im trying to insert information from tempusers_tbl to users_tbl...they are both in the same database...im using ASP as my scripting language and ACCESS as my db...here is my code...
--------------------------------------------------------

<% @ Language="VBScript" %>
<% Option Explicit %>

<html>
<head><title>4.Insert MAIN DB 1 </title></head>
<body>
<%
Dim connection
Dim name
Dim sSQL
Dim sConnString

sSQL = "Insert into users_tbl select name from (select name from tempusers_tbl tb where NOT EXISTS (select null from users_tbl where name = tb.name))"

Set connection = Server.CreateObject("ADODB.connection")

sConnString="DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & Server.MapPath("users.mdb") & ";"

connection.Open sConnString

connection.execute(sSQL)

connection.Close
Set connection = Nothing
%>
Thanks...
</body>
</html>

--------------------------------------------------------
thanks for your time...
techthis is offline  
Old 06-10-2004, 04:52 PM   #2 (permalink)
 
Newb Techie

Join Date: Jun 2004

Posts: 23

prezz0

Default

What error do you get?
prezz0 is offline  
Old 06-10-2004, 05:04 PM   #3 (permalink)
 
Newb Techie

Join Date: Jun 2004

Posts: 10

techthis

Default

i actually figured it out...i changed the sql statement...

sSQL1 = "Insert into users_tbl (name, email, comments) select name, email, comments from tempusers_tbl;"

this worked...thanks though...
techthis is offline  
 
Closed Thread

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