iahngy Posted February 20, 2014 Posted February 20, 2014 I m so new with sql querry and using autoit to the sql db...I wonder if autoit support syntax to get data from SQL server management studio ?
jchd Posted February 20, 2014 Posted February 20, 2014 You can query almost all database engines by using ODBC (ADO) support. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
iahngy Posted February 20, 2014 Author Posted February 20, 2014 I saw in autoit help , it has functions for SQLite instead...from SQLite.au3 such as _SQLite_Changes .........can I use them for SQL server studio. Can you give me an example? I m browsing your signature's tutor sites.
iahngy Posted February 20, 2014 Author Posted February 20, 2014 (edited) so I hve this info to connect to a server , for example, me.home.com , user id , and pwd.. how do I con to that db using the info given using autoit? I ll try to contact a person who know how to querry that db ...I m bugging again morrow. Edited February 20, 2014 by iahngy
spudw2k Posted February 20, 2014 Posted February 20, 2014 (edited) I'm not aware of a UDF for ADO that is included with the AutoIt package, but there are some examples folks have posted on the forum. I have an example in my signature that uses ADO to perform SQL queries with an Access (JET) DB which could be adapted to interface with a SQL Server. Maybe this will help get you started, but search the forum for more examples. In order to connect to a SQL Server you would change what you feed the _OpenConnection() func appropriately. $adCurrentProvider = $adProviderSQLOLEDB $adCurrentDataSource = "Server-Name" $varTrusted = 1 $varCatalog = "DB_NAME" $varUsername = "Username" $varPassword = "Password" _OpenConnection($adCurrentProvider,$adCurrentDataSource,$varTrusted,$varCatalog,$varUsername,$varPassword) Hope that helps. edit:Haven't ran this code in a while and it didn't go so well for me (as far as the JET DB example). Was running with x64 and. Works fine with x86. I don't have a SQL server to test with, but in theory it should (and did) work with SQL Servers in the past. Best look for other examples. Edited February 20, 2014 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
iahngy Posted February 24, 2014 Author Posted February 24, 2014 (edited) I finally can connect to the db ..how can I get the data from the items I selected ? ..sorri I am afraid to display real db name from work..might got trouble If I put real stuff on heheh. $links='driver={SQL Server};Server=me.home.com; database=lab;pwd=lab123; uid=public'; $vcon = ObjCreate ("ADODB.Connection") ; <== Create SQL connection $vcon.open($links) $sQuery = 'select material_name, lot_name, temperature, updated_datetime from lab.view' & _ 'where material_name = "ha403048m00372" order by updated_datetime desc' $result = $vcon.Execute($sQuery) Edited February 24, 2014 by iahngy
iahngy Posted February 24, 2014 Author Posted February 24, 2014 (edited) I finally got it display after search forum and found _sql.au3 from Chris L...I found out sql script doesn't take double quote ". haha $aResult = $result.GetRows() _ArrayDisplay($aResult) Edited February 24, 2014 by iahngy
spudw2k Posted February 27, 2014 Posted February 27, 2014 Good deal. Glad to hear you worked it out. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now