AutoIT - Connecting to SQL Server.

Playing around with AutoIt take me to next level of coding. :) This time I need to automate a process where in a normal situation it will involve a few people to make the whole process completed.

One of the process need a connection to MS-SQL ,execute query and and get the results. As sharing is caring, here I share how to connect to SQL-Server using AutoIt.

$conn = ObjCreate( "ADODB.Connection" )
$DSN = "DRIVER={SQL Server};SERVER=MySvr;DATABASE=MyDB;UID=MyUser;PWD=MyPwd;"
$conn.Open($DSN)
$rs = ObjCreate( "ADODB.RecordSet" )
$rs.Open( "SELECT @@VERSION AS myVersion", $conn )
MsgBox(0, "AutoIT-SQL Result", "Value = " & $rs.Fields( "myVersion" ).Value )
$conn.close

The code will produce a msg box like below.

autoIT SQL Result

Here you go…it’s only the basic code. You can do a lot more than this. :)

Have a nice weekend.

p/s: I have a job to do this weekend…..so..not a very nice weeked for me.adoii….

If you're new here, you may want to subscribe to my RSS feed or get my latest post directly in your mailbox. Thanks for visiting !

Related Post:
  • Design your AutoIt application using Koda FormDesigner
  • AutoIt - automate your task
  • Gambas - Can’t connect to local MySQL server through socket workaround
  • Automate 7 to 8 digit phone number conversion using AutoIT
  • Generating a self signed SSL certificate in Ubuntu Hardy



  • Can't find what you are looking for? Go Gooogle...
    Google

    3 Responses to “AutoIT - Connecting to SQL Server.”

    1. Halim-Belajar SEO on July 21st, 2008 at 7:30 am Using Mozilla Firefox Mozilla Firefox 2.0.0.16 on Windows Windows XP

      I once used autoit for making a bot for angels online but its quite so I stop. Autoit is quite good if you know programming and definitely not for me douh..

      Halim-Belajar SEO’s last blog post..Using GoDaddy for domain registration.

    2. arejae on July 22nd, 2008 at 8:19 am Using Mozilla Firefox Mozilla Firefox 3.0 on Linux Linux

      yeah…need to know at least a little bit programming.

      spammer also like this kind of automate tools. :)

    3. Sarfraz Shah on October 17th, 2008 at 7:16 am Using Opera Opera 9.60 on Windows Windows XP

      Thanks :)

    Leave a Reply


    AWSOM Powered