ASP help ASAP

They have: 5,633 posts

Joined: Jan 1970

What am i missing?????

<?php
@LANGUAGE = JScript
?>
<?php
Response
.Buffer = "True"
?>

<?php
var adoCon = Server.CreateObject("ADODB.Connection"); var path = Server.MapPath("/DBGB/GuestBK.mdb");
var
strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" + path; adoCon.Open(strCon);
var
rset = Server.CreateObject("ADODB.Recordset");
?>

Please Wait.......

<?php
Response
.Flush();
var
nm = new String(Request.Form("name"));
var
ag = new String(Request.Form("age"));
var
gen = new String(Request.Form("gen"));
var
com = new String(Request.Form("tarea"));
var
em = new String(Request.Form("em"));

nm = Server.HTMLEncode(nm);
ag = Server.HTMLEncode(ag);
gen = Server.HTMLEncode(gen);
com = Server.HTMLEncode(com);
em = Server.HTMLEncode(em);

strSQL = "INSERT INTO Book (Name, Age, Email, Gender, Comments) VALUES (" + nm + "," + ag + "," + em + "," + gen +"," + com + ");";
rset = adoCon.Execute(strSQL);
?>

Record Updated

<?php
adoCon
.close();
?>

The sooner the better!

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

You probably need quotes around your strings in the VALUES() sql clause.

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

I haven't done much with ASP, but try the following:

strSQL = "INSERT INTO Book
            (Name, Age, Email, Gender, Comments)
          VALUES
            ('" + nm + "','" + ag + "','" + em + "','" + gen +"','" + com + "')";
'

Another alternative might be:

strSQL = "INSERT INTO Book
            (Name, Age, Email, Gender, Comments)
          VALUES
            (\"" + nm + "\",\"" + ag + "\",\"" + em + "\",\"" + gen +"\",\"" + com + "\")";
'

They have: 5,633 posts

Joined: Jan 1970

Wow! I feel stupid now! Thankx alot, it works now. Now how did you get it to show the code in those boxes.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

[code ] and [/code ]

without the space

They have: 5,633 posts

Joined: Jan 1970

thanks again

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.