ken0137 Posted January 13, 2008 Share Posted January 13, 2008 sorry,my english is bad, i'm a fresh man, au3i want to show one of tables, i don't kown how many rows it have,but i must display all date in the program like the interface of excelfor example the table "sysusers"my program like this if i want ti show any table ,how can i do it ,thank you! Link to comment Share on other sites More sharing options...
Zedna Posted January 13, 2008 Share Posted January 13, 2008 (edited) There are many examples for that on the forum. Just use Search engine.For example look hereexpandcollapse popup; SimpleADOQuery ; Author: Chris Haney ; Most of this stuff is from another author of the AutoIT forum. ; I made it simplified for novice to pro users and added other connection strings. ; Only works in the beta version of autoit at the present time #include <GUIConstants.au3> opt("TrayIconDebug", 1) ;0=no info, 1=debug line info opt("ExpandEnvStrings", 1) ;0=don't expand, 1=do expand opt("ExpandVarStrings", 1) ;0=don't expand, 1=do expand Dim $header = "" Dim $quantity = 0 Dim $dsncount = 1 Dim $button3 ; Use ONE of the next two query statements depending on whether or not you are using a text file Dim $query = "select * from tablename"; for all BUT text connections ;Dim $query = "select * from filename.txt"; for text connections ; Simply un-remark ONE of the connectors below that you will be using ; Not all connectors require the UID and Pwd commands. Try without them first. ;Dim $DSN = "Driver={SQL Server};Server=ServerName;Database=DatabaseName;Uid=UserID;Pwd=Password;"; SQL connector ;Dim $DSN = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=drive:/folder;Extensions=asc,csv,tab,txt;Persist Security Info=False"; TXT file connector ;Dim $DSN = "Driver={Microsoft Access Driver (*.mdb)};Dbq=drive:/filename.mdb;Uid=UserID;Pwd=Password;"; Access file connector ;Dim $DSN = "Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=drive:/filename.xls;DefaultDir=drive:/folder;"; Excel file connector ;Dim $DSN = "Driver={Microsoft ODBC for Oracle};Server=TNSnames_ora;Uid=demo;Pwd=demo;"; Oracle connector $out = getData($DSN) ToolTip("") WinSetTitle("TempWindowName", "", $out&" Rows fetched") While 1 $msg = GUIGetMsg() Select Case $msg = $button3 ExitLoop EndSelect WEnd Func getData($DSN) ; some things are a bit harder to understand in this part ; .Fields("address").Value is the Value of the Field named "address" ; access database would be the same, but you should call out the full table as well ; like .Fields("Tablename.Fieldname").Value ; and EOF is universal for End Of File $cmboVal = "" $adoCon = ObjCreate ("ADODB.Connection") $adoCon.Open ($DSN) $adoRs = ObjCreate ("ADODB.Recordset") $adoSQL = $query $adoRs.CursorType = 2 $adoRs.LockType = 3 $adoRs.Open ($adoSql, $adoCon) GUICreate("TempWindowName", 420, 250) $button3 = GUICtrlCreateButton("OK", 180, 220, 70, 20) With $adoRs ; Get information about Fields collection For $n = 0 To .Fields.Count - 1 $header = $header & .Fields ($n).Name & "|" Next $list = GUICtrlCreateListView(StringTrimRight($header, 1), 10, 10, 400, 200, $LVS_REPORT, $LVS_EX_GRIDLINES) If .RecordCount Then $count = 0 While Not .EOF $count = $count + 1 ToolTip("record search #" & $count, 0, 0) For $colum = 0 To .Fields.Count - 1 $cmboVal = $cmboVal & "" & .Fields ($colum).Value & "|" Next $cmboVal = StringTrimRight($cmboVal, 1) & @CR GUICtrlCreateListViewItem($cmboVal, $list) $cmboVal = "" .MoveNext WEnd GUISetState() EndIf EndWith $adoCon.Close Return $count EndFunc ;==>getData Edited January 13, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
ken0137 Posted January 14, 2008 Author Share Posted January 14, 2008 (edited) thank you very much !!!!! i have another question if i want the value exp "select count(*) as A from table where …………" how can i do it, Edited January 14, 2008 by ken0137 Link to comment Share on other sites More sharing options...
Zedna Posted January 14, 2008 Share Posted January 14, 2008 thank you very much !!!!!i have another questionif i want the value exp "select count(*) as A from table where …………"how can i do it,Just use Search engine as I said. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
guwguw Posted January 15, 2008 Share Posted January 15, 2008 if i want the value exp "select count(*) as A from table where …………"how can i do it, .Fields ("A").Value will contain the count result Link to comment Share on other sites More sharing options...
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