ASP with postgreSQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Regie
    New Member
    • Aug 2007
    • 5

    ASP with postgreSQL

    I have a problem with my asp script that used to insert a data to postgreSQL database.This is the script :

    [code=asp]
    <%
    Dim sConnection, objConn , objRS ,sql

    sConnection ="DRIVER={postg reSQL};SERVER=l ocalhost;databa se=surya;UID=my UserID;PASSWORD =myPWD;port=543 2"

    Set objConn = Server.CreateOb ject("ADODB.Con nection")

    objConn.Open(sC onnection)

    sql="insert into test(number,nam e) values('3','abc d')"
    set objRS = objConn.execute (sql)

    objRS.close
    Set objRS = Nothing
    objConn.Close
    Set objConn = Nothing
    %>

    <html>
    <body><a href="Laporan Pengaduan.asp"> Go</a></body></html>
    [/code]

    I've create the form that submit into this script and that script definitly right,but this script always CANNOT BE DISPLAYED.Surel y my database is working well, and i could insert the data straightly into postgreSQL.Some one please help me
    Last edited by jhardman; Aug 15 '07, 07:24 PM. Reason: put code in code tags, removed pwd, userID
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    What is the exact error message you get?

    Jared

    Comment

    • ilearneditonline
      Recognized Expert New Member
      • Jul 2007
      • 130

      #3
      Originally posted by Regie
      I have a problem with my asp script that used to insert a data to postgreSQL database.This is the script :

      [code=asp]
      <%
      Dim sConnection, objConn , objRS ,sql

      sConnection ="DRIVER={postg reSQL};SERVER=l ocalhost;databa se=surya;UID=my UserID;PASSWORD =myPWD;port=543 2"

      Set objConn = Server.CreateOb ject("ADODB.Con nection")

      objConn.Open(sC onnection)

      sql="insert into test(number,nam e) values('3','abc d')"
      set objRS = objConn.execute (sql)

      objRS.close
      Set objRS = Nothing
      objConn.Close
      Set objConn = Nothing
      %>

      <html>
      <body><a href="Laporan Pengaduan.asp"> Go</a></body></html>
      [/code]

      I've create the form that submit into this script and that script definitly right,but this script always CANNOT BE DISPLAYED.Surel y my database is working well, and i could insert the data straightly into postgreSQL.Some one please help me
      I personally don't like using recordsets for DML statements as you are not returning a recordset. You could try to use the command object instead. But it would be nice to know exactly what the issue you are having is.

      [CODE=asp] Dim cmd
      Set cmd = Server.CreateOb ject("ADODB.Com mand")
      cmd.ActiveConne ction = "DRIVER={postgr eSQL};SERVER=lo calhost;databas e=surya;UID=myU serID;PASSWORD= myPWD;port=5432 "
      cmd.CommandText = "insert into test(number,nam e) values('3','abc d')"
      cmd.CommandType = 1
      cmd.CommandTime out = 30
      cmd.Prepared = true
      cmd.Execute()
      [/CODE]

      Comment

      • Regie
        New Member
        • Aug 2007
        • 5

        #4
        Originally posted by jhardman
        What is the exact error message you get?

        Jared
        I got this message : "This Page Cannot Be Displayed". I usually use this script in postgreSQL :
        "Insert into Pegawai(number, name) values('3','abc d'); " and it was working,but in ASP i think there must be some kind of different with the script.
        Oh yes i'm sorry with the script i've written,cause i'm still newbie and forgot about the rules.I'm very2 sorry.Thanks for your replies
        Last edited by Regie; Aug 16 '07, 05:49 AM. Reason: Description uncompleted

        Comment

        • Regie
          New Member
          • Aug 2007
          • 5

          #5
          Originally posted by ilearneditonlin e
          I personally don't like using recordsets for DML statements as you are not returning a recordset. You could try to use the command object instead. But it would be nice to know exactly what the issue you are having is.

          [CODE=asp] Dim cmd
          Set cmd = Server.CreateOb ject("ADODB.Com mand")
          cmd.ActiveConne ction = "DRIVER={postgr eSQL};SERVER=lo calhost;databas e=surya;UID=myU serID;PASSWORD= myPWD;port=5432 "
          cmd.CommandText = "insert into test(number,nam e) values('3','abc d')"
          cmd.CommandType = 1
          cmd.CommandTime out = 30
          cmd.Prepared = true
          cmd.Execute()
          [/CODE]
          Could you give more specific code from the beginning, because i'm still confused with the code you gave me above.And please use the basic english because i'm Indonesian and still a stundent with bad English hahaha.Thanks for your replies

          Comment

          • ilearneditonline
            Recognized Expert New Member
            • Jul 2007
            • 130

            #6
            Originally posted by Regie
            Could you give more specific code from the beginning, because i'm still confused with the code you gave me above.And please use the basic english because i'm Indonesian and still a stundent with bad English hahaha.Thanks for your replies
            [CODE=asp] <%
            Dim cmd
            Set cmd = Server.CreateOb ject("ADODB.Com mand")
            cmd.ActiveConne ction = "DRIVER={postgr eSQL};SERVER=lo calhost;databas e=surya;UID=myU serID;PASSWORD= myPWD;port=5432 "
            cmd.CommandText = "insert into test(number,nam e) values('3','abc d')"
            cmd.CommandType = 1
            cmd.CommandTime out = 30
            cmd.Prepared = true
            cmd.Execute()
            %>
            <html><body>< a href=[color=#cc0000]"Laporan Pengaduan.asp"[/color]>Go</a></body></html>
            [/CODE]

            Not sure what else you are looking for. If you could be more specific then I can tell you what i know.

            Comment

            • Regie
              New Member
              • Aug 2007
              • 5

              #7
              Originally posted by ilearneditonlin e
              [CODE=asp] <%
              Dim cmd
              Set cmd = Server.CreateOb ject("ADODB.Com mand")
              cmd.ActiveConne ction = "DRIVER={postgr eSQL};SERVER=lo calhost;databas e=surya;UID=myU serID;PASSWORD= myPWD;port=5432 "
              cmd.CommandText = "insert into test(number,nam e) values('3','abc d')"
              cmd.CommandType = 1
              cmd.CommandTime out = 30
              cmd.Prepared = true
              cmd.Execute()
              %>
              <html><body>< a href=[color=#cc0000]"Laporan Pengaduan.asp"[/color]>Go</a></body></html>
              [/CODE]

              Not sure what else you are looking for. If you could be more specific then I can tell you what i know.
              I need the code from the beginning(is that code above connected to my code or it is your code?)to insert the data to postgreSQL.I've tried using similiar scripts in ASP such as i use in PHP to insert the data,but my ASP script still got an error message,it's make me sick.Please tell me all you got.Thanks
              Last edited by Regie; Aug 20 '07, 05:18 AM. Reason: wrong statement

              Comment

              • ilearneditonline
                Recognized Expert New Member
                • Jul 2007
                • 130

                #8
                Originally posted by Regie
                I need the code from the beginning(is that code above connected to my code or it is your code?)to insert the data to postgreSQL.I've tried using similiar scripts in ASP such as i use in PHP to insert the data,but my ASP script still got an error message,it's make me sick.Please tell me all you got.Thanks
                My code would replace yours.

                Comment

                Working...