2 Replies Latest reply: Sep 26, 2017 11:21 AM by Jeremy Latimer RSS

    help me connecting to sqlserver

    mauro mersoni

      I'm trying connecting to SQLSERVER to insert data into a table.

      The following script is attached to a button.

      When I press the button the script page is open letting me know the script is not doing anything because of a error.

       

      the connection string is not working here but if I use it in the loading script it works correctly.

       

      can somebody help me?

       

       

      sub testSomeButtons

      dim sConn, oConn

      rem Set oConn = Nothing

      Set oConn = CreateObject("ADODB.Connection")

      sConn = "Provider=SQLOLEDB.1;Data Source=xxxxxxxx;Initial Catalog=xxxxxxx;User Id=xxxxxxxx;(XPassword is XXXXXXXXXXXX);"

      oConn.Open sConn

      rem sSQL="INSERT INTO [dbo].[mydb] ([text]) VALUES ('pippo')"

      rem oConn.Execute(sSQL)

      rem oConn.Close

      rem Set oConn = Nothing

      msgbox("It's allright")

      end sub