Active Server Pages

Moderators: None (Apply to moderate this forum)
Number of threads: 1763
Number of posts: 4498

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
ASP & SQL Insert problem Posted by Iggy on 10 Apr 2004 at 3:04 AM
This message was edited by Iggy at 2004-4-10 3:55:10

I'm having problems updating an Access databse with this code:

<FORM METHOD = POST ACTION = "RegisterValidation.asp">

UserName : <INPUT TYPE = "text" Size = "10" Name = "UserName">
Full Customer Name: <INPUT TYPE = "text" Size = "10" Name = "CustomerName">
Password : <INPUT TYPE = "text" Size = "10" Name = "Password">
Address : <INPUT TYPE = "text" Size = "20" Name = "Address">
Town : <INPUT TYPE = "text" Size = "20" Name = "Town">
Post Code : <INPUT TYPE = "text" Size = "10" Name = "PostCode">
Tel No : <INPUT TYPE = "number" Size = "10" Name = "TeleNumber">
E-Mail : <INPUT TYPE = "text" Size = "20" Name = "Email">

<INPUT TYPE = "submit" Value = "Enter">


Which links to this:

<%
Set MyConn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & _
Server.MapPath("\eggyharold\db\CTC.mdb")


SQL ="INSERT INTO CUSTOMERS (UserName, CustomerName, Password, Address, Town, PostCode, TeleNumber, Email) values "
SQL = SQL & "('"
SQL = SQL & Request.Form("UserName") & "','"
SQL = SQL & Request.Form("CustomerName") & "','"
SQL = SQL & Request.Form("Password") & "','"
SQL = SQL & Request.Form("Address") & "','"
SQL = SQL & Request.Form("Town") & "','"
SQL = SQL & Request.Form("PostCode") & "','"
SQL = SQL & Request.Form("TeleNumber") & "','"
SQL = SQL & Request.Form("Email") & "');"

MyConn.Execute SQL

%>

I can't see what the error is. I'm new to ASP and SQL, and don't have access to IIS so I'm not getting error messages, just page not found web errors.



Report
Re: ASP & SQL Insert problem Posted by GideonOmega on 10 Apr 2004 at 9:36 AM
: This message was edited by Iggy at 2004-4-10 3:55:10

: I'm having problems updating an Access databse with this code:
:
: <FORM METHOD = POST ACTION = "RegisterValidation.asp">
:
: UserName : <INPUT TYPE = "text" Size = "10" Name = "UserName">
: Full Customer Name: <INPUT TYPE = "text" Size = "10" Name = "CustomerName">
: Password : <INPUT TYPE = "text" Size = "10" Name = "Password">
: Address : <INPUT TYPE = "text" Size = "20" Name = "Address">
: Town : <INPUT TYPE = "text" Size = "20" Name = "Town">
: Post Code : <INPUT TYPE = "text" Size = "10" Name = "PostCode">
: Tel No : <INPUT TYPE = "number" Size = "10" Name = "TeleNumber">
: E-Mail : <INPUT TYPE = "text" Size = "20" Name = "Email">
:
: <INPUT TYPE = "submit" Value = "Enter">
:
:
: Which links to this:
:
: <%
: Set MyConn = Server.CreateObject("ADODB.Connection")
: Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & _
: Server.MapPath("\eggyharold\db\CTC.mdb")
:
:
: SQL ="INSERT INTO CUSTOMERS (UserName, CustomerName, Password, Address, Town, PostCode, TeleNumber, Email) values "
: SQL = SQL & "('"
: SQL = SQL & Request.Form("UserName") & "','"
: SQL = SQL & Request.Form("CustomerName") & "','"
: SQL = SQL & Request.Form("Password") & "','"
: SQL = SQL & Request.Form("Address") & "','"
: SQL = SQL & Request.Form("Town") & "','"
: SQL = SQL & Request.Form("PostCode") & "','"
: SQL = SQL & Request.Form("TeleNumber") & "','"
: SQL = SQL & Request.Form("Email") & "');"
:
: MyConn.Execute SQL
:
: %>
:
: I can't see what the error is. I'm new to ASP and SQL, and don't have access to IIS so I'm not getting error messages, just page not found web errors.
:
:
:
:


Conn.Open should be MyConn.Open

and at the end of your code you should set:
MyConn.close
set MyConn = Nothing


sometimes that will prevent the page from loading if you don't include that ( with brinkster webspace anyways )

C:\Dos
C:\Dos Run
Run Dos Run


Report
Re: ASP & SQL Insert problem Posted by Iggy on 11 Apr 2004 at 4:27 AM
: : This message was edited by Iggy at 2004-4-10 3:55:10

: : I'm having problems updating an Access databse with this code:
: :
: : <FORM METHOD = POST ACTION = "RegisterValidation.asp">
: :
: : UserName : <INPUT TYPE = "text" Size = "10" Name = "UserName">
: : Full Customer Name: <INPUT TYPE = "text" Size = "10" Name = "CustomerName">
: : Password : <INPUT TYPE = "text" Size = "10" Name = "Password">
: : Address : <INPUT TYPE = "text" Size = "20" Name = "Address">
: : Town : <INPUT TYPE = "text" Size = "20" Name = "Town">
: : Post Code : <INPUT TYPE = "text" Size = "10" Name = "PostCode">
: : Tel No : <INPUT TYPE = "number" Size = "10" Name = "TeleNumber">
: : E-Mail : <INPUT TYPE = "text" Size = "20" Name = "Email">
: :
: : <INPUT TYPE = "submit" Value = "Enter">
: :
: :
: : Which links to this:
: :
: : <%
: : Set MyConn = Server.CreateObject("ADODB.Connection")
: : Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & _
: : Server.MapPath("\eggyharold\db\CTC.mdb")
: :
: :
: : SQL ="INSERT INTO CUSTOMERS (UserName, CustomerName, Password, Address, Town, PostCode, TeleNumber, Email) values "
: : SQL = SQL & "('"
: : SQL = SQL & Request.Form("UserName") & "','"
: : SQL = SQL & Request.Form("CustomerName") & "','"
: : SQL = SQL & Request.Form("Password") & "','"
: : SQL = SQL & Request.Form("Address") & "','"
: : SQL = SQL & Request.Form("Town") & "','"
: : SQL = SQL & Request.Form("PostCode") & "','"
: : SQL = SQL & Request.Form("TeleNumber") & "','"
: : SQL = SQL & Request.Form("Email") & "');"
: :
: : MyConn.Execute SQL
: :
: : %>
: :
: : I can't see what the error is. I'm new to ASP and SQL, and don't have access to IIS so I'm not getting error messages, just page not found web errors.
: :
: :
: :
: :
:
:
: Conn.Open should be MyConn.Open
:
: and at the end of your code you should set:
: MyConn.close
: set MyConn = Nothing
:
:
: sometimes that will prevent the page from loading if you don't include that ( with brinkster webspace anyways )
:
: C:\Dos
: C:\Dos Run
: Run Dos Run
:

:
:

Thanks.




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.