Sign in to follow this  
Followers 0
Melkor

Work with MSSQL Server 2000

5 posts in this topic

I'm new.

I can't find answer from previous topic, and ask here.

Prehistory. I have MSSQL Server 2000, and there is big database. Sometime I need make "select", "update" or "delete" (database query) and write result in file. How I can do it from AutoIT? May be exist fuctions where I can insert query and get result...?

help please :whistle:

sorry for my poor english.


Luck, Love and PatienceNikita

Share this post


Link to post
Share on other sites



I'm new.

I can't find answer from previous topic, and ask here.

Prehistory. I have MSSQL Server 2000, and there is big database. Sometime I need make "select", "update" or "delete" (database query) and write result in file. How I can do it from AutoIT? May be exist fuctions where I can insert query and get result...?

help please :whistle:

sorry for my poor english.

Hi,

Maybe you already know this and are searching for a built in stuff but this is how I do. I use the osql command line utility, something like:

Run(@ComSpec & " /c " & 'osql -U DB_UserName -P password -S DB_ServerName -d DataBaseName -Q 'query', "", @SW_HIDE)

Check this URL for a more complete reference of the OSQL syntax:

http://www.di-mgt.com.au/osqlUtility.htm

regards

Share this post


Link to post
Share on other sites

Run(@ComSpec & " /c " & 'osql -U DB_UserName -P password -S DB_ServerName -d DataBaseName -Q 'query', "", @SW_HIDE)

This would help me to but how can i get a result back, i need only one string :whistle:

Share this post


Link to post
Share on other sites

Use thie i/o flags

[optional]Provide a meaningful handle to one or more STD I/O streams of the child process.

1 ($STDIN_CHILD) = Provide a handle to the child's STDIN stream

2 ($STDOUT_CHILD) = Provide a handle to the child's STDOUT stream

4 ($STDERR_CHILD) = Provide a handle to the child's STDERR stream

And monitor the output from run

; Demonstrates StdoutRead()
#include <Constants.au3>

$foo = Run(@ComSpec & " /c dir foo.bar", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

While 1
    $line = StdoutRead($foo)
    If @error Then ExitLoop
    MsgBox(0, "STDOUT read:", $line)
Wend

While 1
    $line = StderrRead($foo)
    If @error Then ExitLoop
    MsgBox(0, "STDERR read:", $line)
Wend

MsgBox(0, "Debug", "Exiting...")

Found in the helpfile.:whistle:

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