Sign in to follow this  
Followers 0
iahngy

does autoit support querry from SQL Server Management Studio

8 posts in this topic

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 ?

Share this post


Link to post
Share on other sites

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 here
RegExp tutorial: enough to get started
PCRE 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)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by iahngy

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by spudw2k

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by iahngy

Share this post


Link to post
Share on other sites

#7 ·  Posted (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)

:thumbsup:  :bike:  :huggles:  :*

Edited by iahngy

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