Sign in to follow this  
Followers 0
ca143508

Working with SQL

7 posts in this topic

#1 ·  Posted (edited)

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.

Michael.

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

@ca143508

Maybe a good start is then to open the HELP file and type in "sqlite".

regards,

ptrex

Ptrex i think he means MS SQL not SQLLITE. I've seen some MS SQL udf in examples forum i think.


My little company: Evotec (PL version: Evotec)

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.

$dbname="master"

$tblname="tbl1"

$fldname="Feild1"

$sqlCon = ObjCreate("ADODB.Connection")

$sqlCon.Open("Driver={SQL Server};Server=127.0.0.1;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=127.0.0.1;Database=Master;Uid=MySQLUser;Pwd=MySQLPassword;")

$adoRs = ObjCreate ("ADODB.Recordset")

$adoSQL = $_sql

$adoRs.CursorType = 2

$adoRs.LockType = 3

$adoRs.Open($adoSql, $adoCon)

$adoRS.AddNew

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

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

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

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

$adoRS.Update

$adoCon.Close

EndFunc

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  
Followers 0