Jump to content

How to Make data View From Access more better


 Share

Recommended Posts

Hello all,

I've script for read data from MS. Access and i put the result on editbox, but the problem is the view on editbox are very ugly. Can we show the result on excel file for more better result ( cause on excel can view by colum and row )? Pls advise

below the script and attachment are db.mdb

Sorry my english no so good, hope you all can understand :mellow:

#include <GUIConstantsEx.au3>

Const $adClipString = 2
Const $field_sep = '   '
Const $row_sep = @crlf
Const $null_char = '-'

$FULL_MDB_FILE_NAME = @ScriptDir & "\db.mdb"
$SQL_CODE = "select * from db"
$CONN = ObjCreate("ADODB.Connection")
$CONN.Open('Driver={Microsoft Access Driver (*.mdb)};Dbq=' & $FULL_MDB_FILE_NAME & ';')
$RecordSet = ObjCreate("ADODB.Recordset")
$RecordSet.Open($SQL_CODE, $CONN)
$test ="Block"
GUICtrlSetData($test, "Block")
GUICreate("Test MS Access", 300, 300)
GUISetState(@SW_SHOW)


GUICtrlCreateLabel("Click Button for show result of query :", 60, 10)
$clickme = GUICtrlCreateButton("Click Me", 100, 25, 80, 30, 0)


While 1

        $Msg = GUIGetMsg()
        Switch $Msg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $clickme
                Database()
            EndSwitch
WEnd            


func database()

if $RecordSet.EOF <> true then

    Dim $header[$RecordSet.Fields.Count]
    for $f = 0 to $RecordSet.Fields.Count-1
        $header[$f] = $RecordSet.Fields($f).Name
    Next
    $data = $RecordSet.GetString($adClipString,262144,$field_sep,$row_sep,$null_char)
    $Edit = GUICtrlCreateEdit($data, 10, 60, 280, 230)
EndIf

$RecordSet.Close
$CONN.Close

endfunc

db.rar

Edited by thienfu
Link to comment
Share on other sites

Instead of putting it in an edit control, use a ListView control

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

No problem If you run into problems with it just come back to this thread and post the code you are having a problem with.

Welcome to the forums by the way.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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