Enjoy an ad free experience by logging in. Not a member yet?
Register .
03-21-2006, 02:03 PM
PM User |
#1
New to the CF scene
Join Date: Mar 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
error with code
Hi,
I am receiving the following error:
Microsoft OLE DB Provider for SQL Server error '80040e14'
Line 1: Incorrect syntax near ','.
/signup.asp, line 38
I cannot not seem to figure out what is wrong. I would appreciate any suggestions. Here is the code:
<!-- #include file = "Include/ADOConn.asp" -->
<%
if(Request.form("action") = "signup") then
email = Request.Form("email")
password = Request.Form("password")
fname = Request.Form("first_name")
lname = Request.Form("last_name")
ph_area = Request.Form("p_area")
ph_ex = Request.Form("p_exchange")
ph_num = Request.Form("p_number")
fax_area = Request.Form("f_area")
fax_ex = Request.Form("f_exchange")
fax_num = Request.Form("f_number")
bus_name = Request.Form("name")
tax_id = Request.Form("tax_id")
set rs1 = server.createobject("ADODB.Recordset")
set rs1 = adoconn.Execute("select * from user_info order by userid desc")
if(rs1.eof and rs1.bof) then
userid = 1
else
rs1.movefirst
userid = cint(rs1("userid")) + 1
end if
Set rs1 = Nothing
promo_code = ""
address1 = ""
address2 = ""
city = ""
state1 = ""
zip_code = ""
country = ""
print_name = ""
print_phone = ""
fee = ""
auto_tab = ""
sql= "insert into user_info values("& userid &",'"& password &"','"& promo_code &"','"& email &"','"& bus_name &"','"& fname &"','"& lname &"',"& ph_area &","& ph_ex &","& ph_num &","& fax_area &","& fax_ex &","& fax_num &",'"& address1 &"','"& address2 &"','"& city &"','"& state1 &"',0,'"& country &"','"& tax_id &"','"& print_name &"','"& print_phone &"',0,'"& auto_tab &"','active')"
set rs = server.createobject("ADODB.Recordset")
set rs = adoconn.Execute(sql)
session("userid") = userid
session("username") = bus_name
Set RS = Nothing
Response.Redirect("signup2.asp")
end if
%>
<!-- Start header -->
<!-- #include file = "header1.asp" -->
<!-- End header -->
<SCRIPT language=JavaScript>
var helpWin = null;
var termsWin = null;
function doHelp()
{
if ( helpWin )
{
helpWin.close();
}
helpWin = window.open( 'trial1_h.htm', '', 'toolbar=no,location=no,resizable=yes,height=450,width=500,scrollbars=yes')
}
function do_alert( fld, msg )
{
alert( 'Please enter ' + msg + '.' );
fld.focus();
fld.select();
return ( false );
}
function validate( f )
{
var phone_msg = 'a complete phone number';
var phone_num = f.p_area.value + f.p_exchange.value + f.p_number.value;
if ( !f.email.value.length ) return ( do_alert( f.email, 'an email address' ) );
if ( !f.password.value.length ) return ( do_alert( f.password, 'a password' ) );
if ( !f.confirm_password.value.length ) return ( do_alert( f.confirm_password, 'a confirmation password' ) );
if ( !f.first_name.value.length ) return ( do_alert( f.first_name, 'your first name' ) );
if ( !f.last_name.value.length ) return ( do_alert( f.last_name, 'your last name' ) );
if ( f.p_area.value.length != 3 ) return ( do_alert( f.p_area, phone_msg ) );
if ( f.p_exchange.value.length != 3 ) return ( do_alert( f.p_exchange, phone_msg ) );
if ( f.p_number.value.length != 4 ) return ( do_alert( f.p_number, phone_msg ) );
if ( !isNumeric( phone_num ) )
{
alert( 'Phone number must be all numbers.' );
f.p_area.focus();
f.p_area.select();
return ( false );
}
if ( f.password.value != f.confirm_password.value )
{
alert( 'Password and confirm-password do not match.' );
f.password.focus();
f.password.select();
return ( false );
}
if ( !isValidEmail( f.email.value ) )
{
alert( 'Please enter a valid email address.' );
f.email.focus();
f.email.select();
return ( false );
}
if ( !f.read_agreement.checked )
{
alert( 'Please acknowledge agreement with Terms of Service.' );
f.read_agreement.focus();
return ( false );
}
return ( true );
}
function isNumeric( str )
{
var ValidChars = "0123456789";
var Char;
for ( var i = 0; i < str.length; i++ )
{
Char = str.charAt(i);
if ( ValidChars.indexOf( Char ) == -1 )
{
return ( false );
}
}
return ( true );
}
function isValidEmail( str )
{
return ( str.indexOf( "." ) > 2 ) && ( str.indexOf( "@" ) > 0 );
}
function showTermsOfService()
{
if ( termsWin && !termsWin.closed )
{
termsWin.close();
}
termsWin = window.open( "terms_of_service_w.htm", '', 'toolbar=yes,resizable=yes,height=600,width=700,scrollbars=yes')
}
</SCRIPT>
<!-- Start body -->
<TABLE cellSpacing=0 cellPadding=0 width="100%" bgColor=#ffffff border=0>
<TBODY>
<TR>
<TD align=right width="100%">
<TABLE cellSpacing=0 cellPadding=0 width="95%" border=0>
<TBODY>
<TR>
<TD width="42%">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD height=25><IMG height=1
src="images/shim.gif"
width=1 border=0></TD></TR>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=5 border=0>
<TBODY>
<TR>
<TD>
<P>The subscription cost is only $12.45 per month with a
one-year commitment. Less than a quarter of an average
signing fee! </P>
<P>You can receive 1 month FREE by pre-paying $136.95
for the full year. </P>
<P>Any subscriber not completely satisfied with the
NotaryListings.com service may cancel his or her
subscription within the first 90 days.<BR><BR>
<DIV align=right><A
href="javascript :showCancellationPolicy();">Cancellation
Policy</A></DIV><BR>
<P></P></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD align=left>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD width=100 height=72>
</TD>
<TD vAlign=center align=middle><IMG height=34 alt=""
src="images/cards_color.gif"
width=193
border=0></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD>
<TD width="2%"> </TD>
<TD width="56%">
<FORM name=signup onSubmit="return validate(this);"
action=signup.asp method=post><INPUT type=hidden value=signup
name=action>
<TABLE cellSpacing=1 cellPadding=20 width="100%" bgColor=#bcbcb2
border=0>
<TBODY>
<TR>
<TD bgColor=#f7f7ee><BR>
<TABLE cellSpacing=1 cellPadding=1 width="100%" border=0>
<TBODY>
<TR>
<TD style="COLOR: #333333">Email address:</TD>
<TD> </TD>
<TD><INPUT maxLength=255 name=email>* </TD></TR>
<TR>
<TD style="COLOR: #333333">Password:</TD>
<TD> </TD>
<TD><INPUT type=password maxLength=20 name=password>*
</TD></TR>
<TR>
<TD style="COLOR: #333333">Confirm password:</TD>
<TD> </TD>
<TD><INPUT type=password maxLength=20
name=confirm_password>* </TD></TR>
<TR>
<TD colSpan=3 height=5><IMG height=1
src="images/shim.gif"
width=1 border=0></TD></TR>
<TR>
<TD style="COLOR: #333333">First name:</TD>
<TD> </TD>
<TD><INPUT maxLength=20 name=first_name>* </TD></TR>
<TR>
<TD style="COLOR: #333333">Last name:</TD>
<TD> </TD>
<TD><INPUT maxLength=20 name=last_name>* </TD></TR>
<TR>
<TD colSpan=3 height=5><IMG height=1
src="images/shim.gif"
width=1 border=0></TD></TR>
<TR>
<TD style="COLOR: #333333">Phone:</TD>
<TD align=right>(</TD>
<TD>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD><INPUT maxLength=3 size=3 name=p_area>)</TD>
<TD><INPUT maxLength=3 size=3 name=p_exchange></TD>
<TD>-<INPUT maxLength=4 size=4
name=p_number>*</TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD style="COLOR: #333333">Fax:</TD>
<TD align=right>(</TD>
<TD>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD><INPUT maxLength=3 size=3 name=f_area>)</TD>
<TD><INPUT maxLength=3 size=3 name=f_exchange></TD>
<TD>-<INPUT maxLength=4 size=4
name=f_number></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD colSpan=3 height=5><IMG height=1
src="images/shim.gif"
width=1 border=0></TD></TR>
<TR>
<TD style="COLOR: #333333">Company name:</TD>
<TD> </TD>
<TD><INPUT maxLength=40 name=name> </TD></TR>
<TR>
<TD style="COLOR: #333333">Tax ID:</TD>
<TD class=body> </TD>
<TD><INPUT maxLength=20 name=tax_id> </TD></TR>
<TR>
<TD style="COLOR: #333333">Promo Code:</TD>
<TD> </TD>
<TD><INPUT maxLength=20 size=12 name=code> </TD></TR>
<TR>
<TD align=right colSpan=3><BR>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD>I agree to these <A
href="javascript :showTermsOfService();">Terms of
Service</A>. </TD>
<TD vAlign=top><INPUT class=inputNoBorder
type=checkbox name=read_agreement>
</TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD colSpan=3>
<TABLE cellSpacing=0 cellPadding=0 width="100%"
border=0>
<TBODY>
<TR>
<TD align=left colSpan=2><A
href="javascript :doHelp()"><IMG height=12
alt="Click here for help"
src="images/help.gif"
width=10 align=absMiddle border=0></A> <B
style="COLOR: #333333">Help</B> </TD></TR>
<TR>
<TD> </TD>
<TD align=right><B
style="COLOR: #333333">Next</B> <INPUT
class=inputNoBorder type=image height=15
alt="Press here to go to step 2" width=18
src="images/arrow_right-brown.gif"
align=absMiddle border=0>
</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><BR></TD></TR></TBODY></TABLE>
</FORM></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<!-- End body -->
<SCRIPT language=javascript>
document.signup.email.select();
document.signup.email.focus();
</SCRIPT>
<!-- Start footer --><!-- #include file = "footer.asp" --><!-- End footer -->
03-21-2006, 03:14 PM
PM User |
#2
Senior Coder
Join Date: Nov 2002
Location: North-East, UK
Posts: 1,265
Thanks: 0
Thanked 0 Times in 0 Posts
Response.Write your query before executing it.
Also, use wrap your code in CODE tags on the forum.
03-21-2006, 03:17 PM
PM User |
#3
New to the CF scene
Join Date: Mar 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Degsy,
Sorry I am kinda new. I'm not sure what you mean by response.write my query before executing it.
Thanks
03-21-2006, 03:19 PM
PM User |
#4
Senior Coder
Join Date: Nov 2002
Location: North-East, UK
Posts: 1,265
Thanks: 0
Thanked 0 Times in 0 Posts
Code:
Response.Write sql
Response.End()
set rs = server.createobject("ADODB.Recordset")
set rs = adoconn.Execute(sql)
See if it producing the correct query & syntax.
03-21-2006, 03:27 PM
PM User |
#5
New to the CF scene
Join Date: Mar 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Ok when I do that I get:
insert into user_info values(7,'testpassword','','test@test.com','toys r su','jeff','harnisch',419,494,3303,419,555,5555,'','','','',0,'','55555','','',0,'','active')
03-21-2006, 03:56 PM
PM User |
#6
Senior Coder
Join Date: Nov 2002
Location: North-East, UK
Posts: 1,265
Thanks: 0
Thanked 0 Times in 0 Posts
Does the query match up with the database fields?
You may want to add the fields
Code:
INSERT INTO table_name (column1, column2,...)
VALUES (value1, value2,....)
03-21-2006, 04:34 PM
PM User |
#7
New to the CF scene
Join Date: Mar 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
ok i think everything matches up:
insert into user_info (userid, password, promo_code, email, username, fname, lname, ph_area, ph_ex, ph_num, fax_area, fax_ex, fax_num, address1, address2, city, state, zip, country_id, tax_id, print_name, print_phone, fee, auto_tab, status)
values(7,'test','','jeffharnisch@buckeye-express.com','','jeff','harnisch',419,466,6666,,,,'','','','','','','','','','','','active')
03-21-2006, 06:37 PM
PM User |
#8
Registered User
Join Date: Jan 2006
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
All of those blank inputs could be an issue.
03-21-2006, 07:13 PM
PM User |
#9
New to the CF scene
Join Date: Mar 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
How so?
03-22-2006, 02:38 PM
PM User |
#10
Senior Coder
Join Date: Nov 2002
Location: North-East, UK
Posts: 1,265
Thanks: 0
Thanked 0 Times in 0 Posts
Does those fields except Null or Empty values?
03-22-2006, 03:06 PM
PM User |
#11
New to the CF scene
Join Date: Mar 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
yes they do
03-22-2006, 03:12 PM
PM User |
#12
Senior Coder
Join Date: Nov 2002
Location: North-East, UK
Posts: 1,265
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by jharnisch74
Ok when I do that I get:
insert into user_info values(7,'testpassword','','test@test.com','toys r su','jeff','harnisch',419,494,3303,419,555,5555,'','','','',0,'','55555','','',0,'','active')
Does that work if you run it through the database query analyzer?
If so you have an error somewhere else in your script.
03-22-2006, 03:19 PM
PM User |
#13
New to the CF scene
Join Date: Mar 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
yes it works fine. It inserts the data into the database.
03-24-2006, 04:16 AM
PM User |
#14
New to the CF scene
Join Date: Mar 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
I cannot seem to find out what is wrong :-(
03-24-2006, 10:58 AM
PM User |
#15
Senior Coder
Join Date: Nov 2002
Location: North-East, UK
Posts: 1,265
Thanks: 0
Thanked 0 Times in 0 Posts
I could only recommend that you strip your code down to basics and debug from scratch.
Jump To Top of Thread
Thread Tools
Rate This Thread
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT +1. The time now is 12:25 AM .
Advertisement
Log in to turn off these ads.