Click to See Complete Forum and Search --> : Insert Error


aseelbathery
12-28-2006, 02:29 AM
When I'm executing this code i get following error. can anybody help me?

Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error in INSERT INTO statement.
/session/Register.asp, line 28

Here's my code..

<!--#include file="adovbs.asp" -->
<!--#include file="DBConnecter.asp" -->

<% Response.Buffer = True %>

<%
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma" , "no-cache"
Response.Expires = -1

Dim pwd
Dim userid

userid = Request.Form("uname")
pwd = Request.Form("pwd")

If userid <> "" Then
If pwd <> "" Then
Dim Ors
Set Ors = Server.CreateObject("Adodb.Recordset")
Ors.Open "SELECT * FROM table_session WHERE uid = '"&userid&"'",cnnDB,3
If Ors.RecordCount > 0 Then
Response.Write "Sorry! This user name is already taken"
Set Ors = Nothing
Set cnnDB = Nothing
Else
Dim records
cnnDB.Execute "INSERT INTO table_session(uid,password) VALUES" & _
"('" & userid & "','" & pwd & "')" , records
If resords = 1 Then
Response.Write "You Have Been registered Successfully!"
Set Ors = Nothing
Set cnnDB = Nothing
Session("UID") = userid
Response.Redirect "Default.asp"
Response.End
Else
Response.Write Err.Description
Set Ors = Nothing
Set cnnDB = Nothing
Response.End
End If
End If
Else
Response.Write "Password Should not be Empty!"
End If
End If
%>

<html>
<head>
<title>Register</title>
<script language="JavaScript">
function callsubmit()
{
if (frm1.pwd.value==frm1.pwdc.value) {
frm1.submit();
}
else
{
alert("Password Doesn't match. Please Try again");
}
}
</script>
</head>
<body>
<form name="frm1" method="post" id="frm1">
<p>
Login ID: <input type="Text" id="uname" name="uname">
Password: <input type="Password" id="pwd" name="pwd">
Confirm Password: <input type="Password" id="pwdc" name="pwdc">
</p>
<input type="Button" id="submit1" value="Register" name="submit1" onclick="callsubmit()">
</form>
</body>
</html>

russell
12-28-2006, 08:55 AM
sure uid and password have values?

if u change this

cnnDB.Execute "INSERT INTO table_session(uid,password) VALUES" & _
"('" & userid & "','" & pwd & "')" , records

to

Dim sql

sql = "INSERT INTO table_session(uid,password) VALUES" & _
"('" & userid & "','" & pwd & "')"

Response.Write sql

cnnDB.Execute sql, records
you can inspect the query to see what's wrong

aseelbathery
01-08-2007, 05:36 AM
can you please tell me how to send sms from asp programming? i'm developing a site where after registration, registrant should get an sms alert to his mobile.

Please Help me

Thanks & Regards,
Aseel

carsonweb
01-10-2007, 11:35 AM
What is SMS alert?

russell
01-10-2007, 11:48 AM
a text message i believe...

aseelbathery
01-11-2007, 08:18 AM
Yes. sending text message from my site to the mobile phone of the person who is registerd to my site. and it's in ASP

Thanks & Regards,

Aseel