Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
Konversi File Txt Ke Database

Konversi File Txt Ke Database

Ratings: (0)|Views: 24 |Likes:
Published by Erfan Ardiawan
Cara Konversi File Txt Ke Database
Cara Konversi File Txt Ke Database

More info:

Categories:Types
Published by: Erfan Ardiawan on Oct 04, 2013
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/12/2014

pdf

text

original

 
www.konsultasivb.com 
Oleh : Uus Rusmawan Hal - 1
 
Konversi file txt ke database
Coding :
Private Function htgbrs(strFileName As String) As LongOn Error GoTo ErrHandlerDim fso As FileSystemObjectDim TextStream As TextStreamDim lngBaris As Long, sLine As String'Buat object dengan menggunakan FSOSet fso = CreateObject("Scripting.FileSystemObject")'Buka file dan tampung ke dalam TextStreamSet TextStream = fso.OpenTextFile(strFileName)'Ulangi selama belum mencapai akhir baris'(akhir dari stream).Do While TextStream.AtEndOfStream = False'Baca setiap satu barissLine = TextStream.ReadLine'Update counter barislngBaris = lngBaris + 1Loop'Setelah selesai, tutup fileTextStream.Close'Kembalikan jumlah baris yang diperolehhtgbrs = lngBarisExit FunctionErrHandler:MsgBox "anda membatalkan memilih file"End FunctionPrivate Sub Form_Activate()Jumlah.RefreshEnd SubPrivate Sub Form_Load()
 
www.konsultasivb.com 
Oleh : Uus Rusmawan Hal - 2
 
DTPicker1.Format = dtpShortDateCall KONEKSIRS.Open "select * from " & Combo1.Text, CON, adOpenDynamic,adLockOptimisticCombo1.AddItem "MATRIX"Combo1.AddItem "DUNNING"'Combo1.AddItem "STARONE"Label5 = DateIf Menu.StatusBar1.Panels(2) = "OPERATOR" ThenCommand1.Enabled = FalseCommand2.Enabled = FalseEnd IfEnd SubPrivate Sub Combo1_Click()NmFile.Caption = ""Call KONEKSIRS.Open "select * from " & Combo1.Text, CON, adOpenDynamic,adLockOptimisticEnd SubPrivate Sub Command1_Click()Dim TAMP As StringDim i As DoubleDim kata As Stringu.Filter = "*.*|*.*"u.ShowSaveALAMAT = u.FileNameNmFile.Caption = u.FileName'Label9 = htgbrs(u.FileName) & " Record"End SubPrivate Sub Command2_Click()res = SetWindowPos(restore.hWnd, HWND_TOPMOST, 0, 0, 0, 0, flags)If NmFile.Caption = "" Or NmFile.Caption = vbNullString ThenMsgBox "Pilih dulu file txt yang akan direstore"Command1_ClickExit SubEnd IfScreen.MousePointer = vbHourglassCall importDim SQLEdit As StringSQLEdit = "update " & Combo1.Text & " set jenis='" & Combo1.Text &"'"CON.Execute SQLEditDim sqlsimpan As String
 
www.konsultasivb.com 
Oleh : Uus Rusmawan Hal - 3
 
sqlsimpan = "insert into log1(tglambilfile,tglrestore,namafile,namauser) values " & "('" & Format(DTPicker1, "mm/dd/yy") & "','" & Format(Label5.Caption,"mm/dd/yy") & "','" & NmFile.Caption & "','" &Menu.StatusBar1.Panels(1) & "')"CON.Execute sqlsimpanMsgBox "Proses restore sukses..."Screen.MousePointer = vbDefaultNmFile.Caption = ""res = SetWindowPos(restore.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, flags)End SubPrivate Sub Command3_Click()'Call HAPUSDATAUnload MeEnd SubSub import()On Error Resume NextTimer1.Interval = 10ProgressBar1.Value = Text1Dim TAMP As String, TAMP1 As StringDim j As DoubleDim jumlahdata As DoubleOpen NmFile.Caption For Input As #1TAMP = Input(LOF(1), 1)Close #1If InStr(TAMP, Chr(10)) <> 0 Then TAMP = Replace(TAMP, Chr(10), "")rr = Split(Trim(TAMP), Chr(13))For i = LBound(rr) To UBound(rr)Dim SS As StringDim tgl As DateIf Left(rr(i), 1) = Asc(10) Or Left(rr(i), 1) = Asc(13) Then SS =Mid(rr(i), 2, Len(rr(i)) - 1) Else SS = rr(i)If SS <> "" ThenSS = Replace$(SS, ":", ";")SS = Replace$(SS, """", "")rr2 = Split(Trim(SS), ";")'===========================================================================Jumlah = RS.RecordCount + 1 & " Record [Tunggu hingga prosesselesai...!!]"Jumlah.Refresh'===========================================================================RS.AddNewFor j = LBound(rr2) To UBound(rr2)RS(j) = rr2(j)NextRS.UpdateRS.Requery

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->