Jump to content

mdthanh

Members
  • Posts

    9
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

mdthanh's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Thanks Ajit, I am working on MySQL and support select existing tables/view of MSSQL. Hope I can finish it soon.
  2. Hi, I have completed a script to export data from MSSQL or MSACCESS to Excel Hope it useful for someone. Screenshot: Features: Support database: MSSQL, MSACCESS Export speed of MSSQL: arround 15 seconds for 700,000 records with more than 30 fields. Will support more databases on next time and allow to select existing tables/views if any. MDT, ExportToExcelV1.rar
  3. Can you post your script here?
  4. The code below is from Autoit Help. Please copy, run and try it you will see the way to build the GUI of your demo. Its very simple and easy let believe that. #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $MESSAGE = "The following buttons have been clicked" Local $add, $clear, $mylist, $close, $msg GUICreate("My GUI list") ; will create a dialog box that when displayed is centered $add = GUICtrlCreateButton("Add", 64, 32, 75, 25) $clear = GUICtrlCreateButton("Clear", 64, 72, 75, 25) $mylist = GUICtrlCreateList("buttons that have been clicked", 176, 32, 121, 97) GUICtrlSetLimit(-1, 200) ; to limit horizontal scrolling GUICtrlSetData(-1, $MESSAGE) $close = GUICtrlCreateButton("my closing button", 64, 160, 175, 25) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $add GUICtrlSetData($mylist, "You clicked button No1|") Case $msg = $clear GUICtrlSetData($mylist, "") Case $msg = $close MsgBox(0, "", "the closing button has been clicked", 2) Exit EndSelect WEnd EndFunc ;==>Example
  5. Hi VietnamIt, You want to build a small tool which allow user to select and then one click for install selected softwares? If that, then your challenges could be: 1. Create a listview which keep all softwares for installing. For this task, I saw you use GUICtrlCreateList to create it and now you have to add name of softwares to that list, use GUICtrlSetData function. 2. Install selected softwares by one click. That mean, you have to run it in hidden mode or your script automatic answer and select options due to installing the software So, firstly I think you need to study about softwares you want to auto install, ex: for Firefox from Chimeara's link you can know how to install it by command line and in silent mode. And it better if you spend couple of hours study example from Autoit's help and this forum, a lots of things for you and for me. Chúc may mắn!
  6. Hi All, I forgot one thing: $oExcel.ActiveWorkBook.ActiveSheet.Cells(1,1).CopyFromRecordset ($oExeResult) Just work with Excel 2000 and later. For excel 97 or earlier, you need to do another way that could transfer all data to array before copy to excel. Sorry,
  7. Hi, I have looking for the code to export data from MSSQL to excel but could not and after spend some hours I completed the code to do it as below: #include <sqlconnect.au3> #include <GUIConstantsEx.au3> #include <Excel.au3> $oConnectSQL = _SQLConnect('MSSQLServer', 'MSSSQLDBName', 1, 'UserName', 'Password') ; GUI GuiCreate("Sample GUI", 400, 400) ; BUTTON $varSalesTeamCode = GuiCtrlCreateButton("Export", 150, 65, 100, 30) ;Show window/Make the window visible GUISetState(@SW_SHOW) While 1 ;After every loop check if the user clicked something in the GUI window $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ;Destroy the GUI including the controls _SQLDisconnect($oConnectSQL) GUIDelete() ;Exit the script Exit ;Check sales team amount Case $msg = $varSalesTeamCode $oExeResult = _SQLQuery($oConnectSQL, "Your Query Here") if not IsObj($oExeResult) then Msgbox(0,"Error","$oExeResult is not an Object.") else $oExcel = ObjCreate("Excel.Application") ; Create an Excel Object $oExcel.Visible = 1 ; Let Excel show itself $oExcel.WorkBooks.Add ; Add a new workbook $oExcel.ActiveWorkBook.ActiveSheet.Cells(1,1).CopyFromRecordset ($oExeResult) ; Fill a cell $oExcel.ActiveWorkBook.Saved = 1 ; Simulate a save of the Workbook MsgBox(0, "Exiting", "Export complete, Press OK to Save File and Exit") endif EndSelect WEnd Hope it could help someone. Cheers, sqlconnect.au3
  8. Oopp, so let hope other could use my post. Thanks you all,
  9. Hi Merrik, Somewhere in forum help me got sqlconnect.au3 attached here. And to use it to update your table, you need to create another file as updatedata.au3 and declare as below: #include <sqlconnect.au3> #include <GUIConstantsEx.au3> ;Connect to sqldatabase $oConnectSQL = _SQLConnect('servername', 'databasename', 1, 'username', 'password') ;1 = sql authentication ;Execute the query to update your table $oExeResult = _SQLQuery($oConnectSQL, "update yourtable set field1='A', field2 = 'B' where ID=123 "); be careful with your update script if not IsObj($oExeResult) then Msgbox(0,"Error","$oExeResult is not an Object.") else Msgbox(0,"Error","Update data successfully") endif ;Disconnect database _SQLDisconnect($oConnectSQL) ;Your code to create gui here
×
×
  • Create New...