Jump to content
Sign in to follow this  

Working with SQL

Recommended Posts

Hi Guys,

I have no idea where to start on this one as I haven't had to do anything SQL based within Autoit yet and was hoping someone can help me out.

I want to create a GUI app which has 3 fields on it. File Name, Expiry Date & Category. Once the user fills out those fields and hits a submit button, I want it to write to a table called "Records" for example in the matching fields on a remote server running SQL 2000. Ideally it would be great to not have to have a system DSN configured on the machine if that is at all possible.

Any help or advice you can give me would be fantastic.

Thanks in advance guys.


Edited by ca143508

Share this post

Link to post
Share on other sites

I have done work with SQL before. I know how to build queries etc but integrating into AutoIT is where I have no idea where to start.

Share this post

Link to post
Share on other sites

Ok - So I have got my SQL stuff sorted (Thanks to some code on the forum here which got me in the right direction). now I am only stuck on the GUI side of things. How to I get a GUI to call the function after the fields are filled in and use those entries to populate my dbase??? a copy of my SQL code is below.




$sqlCon = ObjCreate("ADODB.Connection")

$sqlCon.Open("Driver={SQL Server};Server=;Database=Master;Uid=MySQLUser;Pwd=MySQLPassword;")

$SQL = "SELECT * FROM tbl1"

$DSN_Connect = _getfield($SQL,$dbname,$fldname)

Func _getfield($_SQL,$_dbname,$_fldname)

dim $_output

$adoCon = ObjCreate("ADODB.Connection")

$adoCon.Open("Driver={SQL Server};Server=;Database=Master;Uid=MySQLUser;Pwd=MySQLPassword;")

$adoRs = ObjCreate ("ADODB.Recordset")

$adoSQL = $_sql

$adoRs.CursorType = 2

$adoRs.LockType = 3

$adoRs.Open($adoSql, $adoCon)


$adoRS.Fields("Field1").Value = "InputField1"

$adoRS.Fields("Field2").Value = "InputField2"

$adoRS.Fields("Field3").Value = "InputField3"

$adoRS.Fields("Field4").Value = "InputField4"




Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...