Jump to content

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.

Michael.

Edited by ca143508
Link to comment
Share on other sites

  • 2 weeks later...

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...