Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2012
    Posts
    1

    Unanswered:

    I am trying to make script to imput some data from IIS to database. But I am always facing kinds of errors.

    Suppose I need 10 numbers, a1,a2....a10 input from IIS, How can I import these numbers in to access database?

    I am really new in the field, hope I could get some help from here

    Thanks in advance

    I posted message yesterday asking about saving data into database
    But I did not show too much detail

    Now I am attaching my code and hope some one could help me figure out the reason

    My error is

    Microsoft JET Database Engine (0x80040E14)
    INSERT INTO
    /messageposted.asp, line 90 which is at the line

    objConn.Execute strCommand


    My code is attached, hope some one could help

    Thanks a lot


    <%@ Language=VBScript %>

    <html>
    <head>
    <title>The Recipe Book</title>

    <META HTTP-EQUIV="Refresh"
    Content = "4;
    URL='message.asp'">

    </head>

    <body vlink=0000FF link=0000FF alink=0000FF bgcolor=FFFFFF>

    <font face="Arial,Helvetica">
    <h2>Post</h2>

    <%



    dim strTB1, strTB2, strTB3, strTB4, strTB5, strTB6, strTB7, strTB8, strTB9, strTB10, strTB11, strTB12, strDiff, strCount, strCommand

    strTB1 = Server.HTMLEncode(Request.QueryString("Temp"))
    strTB2 = Server.HTMLEncode(Request.QueryString("Press"))
    strTB3 = Server.HTMLEncode(Request.QueryString("6mu1"))
    strTB4 = Server.HTMLEncode(Request.QueryString("6mu2"))
    strTB5 = Server.HTMLEncode(Request.QueryString("6left"))
    strTB6 = Server.HTMLEncode(Request.QueryString("6right"))
    strTB7 = Server.HTMLEncode(Request.QueryString("6bottom"))
    strTB8 = Server.HTMLEncode(Request.QueryString("6center"))
    strTB9 = Server.HTMLEncode(Request.QueryString("6inner"))
    strTB10 = Server.HTMLEncode(Request.QueryString("6outer"))

    strTB11= Date
    strTB12 = Time

    strTB1 = replace(strTB1,"'","''")
    strTB2 = replace(strTB2,"'","''")
    strTB3 = replace(strTB3,"'","''")
    strTB6 = replace(strTB6,"'","''")

    dim OK
    OK=1

    If strTB1 = "" OR strTB2 = "" OR strTB3 = "" OR strTB6 = "" Then
    OK = 0
    End If

    OK=1
    If OK Then

    strProvider = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=C:\inetpub\wwwroot\daily01.mdb;"

    Set objConn = server.createobject("ADODB.Connection")


    objConn.Open strProvider


    strCommand = "INSERT INTO daily01(mtemp,mpress,mu1,mu2,left,right,bottom,cen ter,inner,outer,mdate,mtime)VALUES ('"
    strCommand = strCommand & strTB1 & "','" & strTB2 & "','" & strTB3 & "','" & strTB4 & "','" & strTB5 & "','" & strTB6 & "','"
    strCommand = strCommand & strTB7 & "','" & strTB8 & "','" & strTB9 & "','" & strTB10 & "','" & strTB11 & "','" & strTB12
    strCommand = strCommand & "')"


    objConn.Execute strCommand

    strQuery = strQuery & " ORDER BY MessageID"

    Set objRS = objConn.Execute(strQuery)

    strCount = 0
    While Not objRS.EOF
    strCount = strCount + 1
    objRS.MoveNext
    Wend


    If strCount > 50 Then
    strDiff = strCount - 50
    objRS.MoveFirst
    For I = 1 to strDiff
    strCommand = "DELETE FROM Messages WHERE MessageID=" & objRS(0)
    objConn.Execute strCommand
    objRS.MoveNext
    Next

    End If


    objConn.Close

    Response.Write("Thank you! Your message has been posted.<P>")
    Response.Write("Redirecting...")

    Else

    Response.Write("We are sorry but your message included objectionable content or was empty. Please try to be polite and do not spam the message board.<P>")
    Response.Write("Redirecting...")

    End If


    %>

    </font>
    </body>
    </html>
    Last edited by healdem; 03-28-12 at 08:43.

  2. #2
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    Without looking too fare I think your sql has a typo ie I think this
    ,cen ter,
    shold be either this
    ,center,
    or this
    ,[cen ter],

    Spaces in field names will not be recognised if not enclosed in square brackets.


    ??

    MTB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •