Junior <[EMAIL PROTECTED]> wrote:
aku mau ngeksport salah satu tabel (misal tabel TransaksiOK) di database ke
tex (notepad) biar waktu kirimnya jadi lebih cepet, begitu juga sebaliknya
import text ke tabel Database lewat VB. ada yang tau gak ya... kasih bocorannya
donk
Terimakasih sebelumnya
================================= coba code ini
nama_table, field1, field2, field3 menyesuaikan
Private Sub ExporData()
Dim Conn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
Dim strSQL As String
Dim NoFile As Integer
NoFile = FreeFile
strSQL = "SELECT field1, field2, field3 FROM nama_tabel"
Set Rs = Conn.Execute(strSQL)
If Not Rs.EOF Then
Open App.Path & "\file_hasil_export.txt" For Output As NoFile
Do While Not Rs.EOF
Write #NoFile, Rs("field1"), Rs("field2"), Rs("field3")
Rs.MoveNext
Loop
End If
Rs.Close
Set Rs = Nothing
Close #NoFile
End Sub
Private Sub ImportData()
Dim Conn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
Dim strSQL As String
Dim NoFile As Integer
NoFile = FreeFile
Dim field1 As String, field2 As String, field3 As String
NoFile = FreeFile
Open App.Path & "\file_hasil_export.txt" For Input As NoFile
Do While Not EOF(NoFile)
Input #NoFile, field1, field2, field3
strSQL = "INSERT INTO nama_tabel (field1, field2, field3) VALUES ('" &
field1 & "', '" & field2 & "', '" & field3 & "')"
Conn.Execute strSQL
Loop
Close #NoFile
End Sub
---------------------------------
Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new
and used cars.
[Non-text portions of this message have been removed]
Untuk berhenti berlangganan kirim email kosong ke : [EMAIL PROTECTED]
Ikuti juga forum diskusi VB.net dengan
mengirim email kosong ke [EMAIL PROTECTED]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/indoprog-vb/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/