Jump to content

does autoit support querry from SQL Server Management Studio


iahngy
 Share

Recommended Posts

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)

Link to comment
Share on other sites

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

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

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

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
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...