View previous topic :: View next topic |
Author |
Message |
xnemesis
Joined: 22 May 2005 Posts: 1
|
Posted: Sun May 22, 2005 11:38 am Post subject: Insert Into Help! |
|
|
I have 2 tables in a database. One called "View" and one called "Main". These aren't linked for various reasons, though they can be linked if it will solve me problem.
I am trying to insert values into both view and main. (These being part of a logging in and storing details system)
The code is as follows
Code:
Code: | set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Mode=adModeReadWrite
conn.Open "htdocs\ADO\database.mdb"
sql="INSERT INTO Main Values"
sql=sql & "('" & Request.Form("Username") & "',"
sql=sql & "'" & Request.Form("Password") & "',"
sql=sql & "'Basic',"
sql=sql & "'" & Request.Form("Firstname") & "',"
sql=sql & "'" & Request.Form("Lastname") & "',"
sql=sql & "'" & Request.Form("Country") & "',"
sql=sql & "'" & Request.Form("Email") & "')"
sql=sql & " AND "
sql=sql & "INSERT INTO View Values"
sql=sql & "('" & Request.Form("Username") & "',"
sql=sql & "'#c0d9e9',"
sql=sql & "'#e2f2fb',"
sql=sql & "'#a0d4f2',"
sql=sql & "'#e2f2fb',"
sql=sql & "'#a0d4f2',"
sql=sql & "'#ffffff')"
on error resume next
conn.Execute sql
if err<>0 then
for each Err in Conn.Errors
response.write("<p>")
response.write("Description: ")
response.write(Err.Description & "<br />")
response.write("Help context: ")
response.write(Err.HelpContext & "<br />")
response.write("Help file: ")
response.write(Err.HelpFile & "<br />")
response.write("Native error: ")
response.write(Err.NativeError & "<br />")
response.write("Error number: ")
response.write(Err.Number & "<br />")
response.write("Error source: ")
response.write(Err.Source & "<br />")
response.write("SQL state: ")
response.write(Err.SQLState & "<br />")
response.write("</p>")
next
Response.Write("<h3>Error</h3><P>")
Response.Write("An error occured while trying to register you! Please contact the
site administrator for further support.")
else
Response.Write("<h3>You have successfully been register</h3>")
Repsonse.Write("An email has been sent to you to keep as a record of your user
details. Please keep this email private and in a safe place. Click HERE to login!")
end if
conn.close |
I have tried doing the 2 inserts seperately; executing one then compiling th eother into the variable then executing that one. but it still gives me the same error stating "Illegal Assignment". The database is not read only, have complete access to it and performing just the one insert (Main) works, but not with the second.
Any help appreciated
Thanks |
|
Back to top |
|
|
administrator Site Admin
Joined: 01 Oct 2004 Posts: 183
|
Posted: Mon May 23, 2005 10:18 pm Post subject: |
|
|
Hi,
Print both SQL statements with Response.Write and post them here, and I should be able to help you.
Thanks, _________________ Peter
ASP & ASP.NET Articles and Tutorials |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|