Kamis, 24 Juni 2010


[VBS] Menyimpan Table Database Ke Dalam Text File

  • Kamis, 24 Juni 2010
  • Nurkholish Ardi Firdaus
  • Share
  • On Error Resume Next
    Dim ADO, onjRecordSet, objField
    Dim strTable,fso, objText, strTxtPath
    Set fso = WScript.CreateObject("Scripting.Filesystemobject")
    Set ADO = CreateObject("ADODB.Connection")
    Set objRecordset = CreateObject("ADODB.Recordset")
    Const adOpenStatic = 3
    Const adLockOptimistic = 3
    Const ForAppending = 8

    ' Open DataBase with ConnectionString
    ADO.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=F:\Program Files\Microsoft Visual Studio\"& _
    "VB98\BIBLIO.mdb;Mode=ReadWrite|Share Deny None;Persist Security Info=False"

    objRecordset.CursorLocation = 0
    'Load all Record in Titles Table
    objRecordset.Open "SELECT * FROM Titles ORDER BY Title" , ADO, _
    adOpenStatic, adLockOptimistic
    MsgBox "Press OK and Please Wait"
    With WScript
    strTxtPath=Left(.ScriptFullName,Len(.ScriptFullName)- _
    Len(.ScriptName)) & "TextDB.txt"
    End with
    fso.CreateTextFile strTxtPath,true
    Set objText=fso.OpenTextFile(strTxtPath,ForAppending)
    Do Until objrecordset.EOF
    For Each objField In objRecordset.Fields
    strTable=strTable & objField.Name & ": " & objfield.Value & vbCrLf
    strTable=strTable & "--------------------------" & vbCrLf
    objText.WriteLine strTable
    objText.Close ' Close Text I/O
    objRecordset.Close ' Close Record
    ADO.Close ' Close DataBase
    MsgBox "Saved as " & strTxtPath
    '(c) 2010 Crowja

    Jangan Lupa Komentar Yaa..
    Related Posts Plugin for WordPress, Blogger...

    2 Komentar Untuk “[VBS] Menyimpan Table Database Ke Dalam Text File”

    Blogger mengatakan...
    Selasa, 11 Oktober 2016 20.10.00 WIB Reply To This Comment

    Did you know that that you can generate cash by locking selected areas of your blog or site?
    Simply open an account with AdscendMedia and embed their Content Locking widget.

    Blogger mengatakan...
    Jumat, 03 Agustus 2018 01.47.00 WIB Reply To This Comment

    Easily Increase Your ClickBank Banner Traffic And Commissions

    Bannerizer makes it easy for you to promote ClickBank products with banners, simply visit Bannerizer, and grab the banner codes for your picked ClickBank products or use the Universal ClickBank Banner Rotator Tool to promote all of the available ClickBank products.

    Posting Komentar

    Berikan komentar positif tentang artikel yang sederhana ini niscaya sobat akan mendapatkan balasannya. Hehehe