472,117 Members | 2,563 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,117 software developers and data experts.

SQL query error

Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2. <Body>
  3. <Form  Method=Post   Action="Insert.asp">
  4. ROLL NO.    <Input type=text  Name=rol><br>
  5. Name     <Input type=text Name=nm><br>
  6. Address    <Input type=text Name=adr><br><br>
  7. <Input type=submit Value="Submit Info.">
  8. </form>
  9.  
  10. <%
  11. Dim r, n, a, RS, conn, qr
  12.  
  13. r = Request.Form("rol")
  14. n = Request.Form("nm")
  15. a = Request.Form("adr")
  16.  
  17. Set conn = Server.CreateObject("ADODB.Connection")
  18. conn.Provider = "Microsoft.JET.OLEDB.4.0"
  19. conn.Open  "c:/students.mdb"
  20.  
  21. Set RS = Server.CreateObject("ADODB.Recordset")
  22. qr = "INSERT  INTO  t1(Roll,sNm,Address)  Values( "&r&" , ' "&n&" ' , ' "&a&" ')"
  23.  
  24. RS.Open qr, conn, 2, 3
  25.  
  26. conn.Close
  27. set conn= nothing
  28.  
  29. %>
  30.  
  31. </body>
  32. </html>

This program gives foll. error :
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error in INSERT INTO statement.
/DB-ex/Insert.asp, line 24


Please help
Oct 11 '07 #1
3 1042
debasisdas
8,127 Expert 4TB
Try the following
Expand|Select|Wrap|Line Numbers
  1. qr = "INSERT  INTO  t1(Roll,sNm,Address)  Values( " & r & " ,' "& n & "','" & a &"')"
Oct 11 '07 #2
r035198x
13,262 8TB
Moved to ASP forum
Oct 11 '07 #3
pbmods
5,821 Expert 4TB
Heya, bsayali. Welcome to TSDN!

Please use CODE tags when posting source code:

[CODE=asp]
ASP code goes here.
[/CODE]
Oct 11 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by Polar | last post: by
10 posts views Thread by johnnyboy10017 | last post: by
2 posts views Thread by jaysonsch | last post: by
3 posts views Thread by Nick Truscott | last post: by
6 posts views Thread by Martin Lacoste | last post: by
11 posts views Thread by Arpan | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.