Melkor Posted November 1, 2006 Posted November 1, 2006 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 sorry for my poor english. Luck, Love and PatienceNikita
Hemmansaegarn Posted November 3, 2006 Posted November 3, 2006 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 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.htmregards
Uten Posted November 5, 2006 Posted November 5, 2006 There are some nice ADO udfs in Scripts & Scraps. Do a title search Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
Dietmar Posted November 6, 2006 Posted November 6, 2006 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
Uten Posted November 6, 2006 Posted November 6, 2006 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 streamAnd 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. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
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