taruh counternya dimana ya mas..
bingung nih..

jonathan




"Heru Rahadyan" <[EMAIL PROTECTED]> 
Sent by: [email protected]
28/02/2008 14:44
Please respond to
[email protected]


To
<[email protected]>
cc

Subject
RE: [Programmer-VB] Ambil data dari csv file






 
Ini ada metode lain
Utk mengambil ke x saja
Mungkin bisa pake counter
 
Dim A as long
 
A = 0
 
Do while ….
            A = A + 1          ‘baris ke A
            If A <> 1 then    ‘bisa disesuaikan
                        Perintahnya
            End IF
Loop
 
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] 
On Behalf Of Jonathan Oei Joeng
Sent: Wednesday, February 27, 2008 8:27 PM
To: [email protected]
Subject: [Programmer-VB] Ambil data dari csv file
 

teman2, 

Saya lagi buat aplikasi untuk ambil data dari csv file ke access database 
cuman saya tidak ingin ambil line 1 
kira-kira gimana cara buat scriptnya ya.. 
ni contoh script yang sudah dibuat : 

Module Module1 
    Dim con As New OleDbConnection 
    Dim strProvier As String 


    Sub Main() 
        Dim strProvier = "Provider=Microsoft.Jet.OLEDB.4.0;Data 
Source=db1.mdb" 
        Dim con As New OleDbConnection(strProvier) 
        Dim cmd As New OleDbCommand() 
        Dim effectedRow As Integer 
        Dim lineCounter As Integer 

        con.Open() 

        If (con.State.ToString() = "Open") Then 
            Console.WriteLine("Connected To Database") 

            Dim stReader As New StreamReader("QC.Q01") 
            Dim strRowData As String() 

            Do While stReader.Peek() >= 0 
                lineCounter = lineCounter + 1 
                strRowData = stReader.ReadLine().Split("|") 

                Try 
                    cmd.CommandText = "INSERT INTO 
Table1(Name,Assay,Result,Unit) VALUES ('" & strRowData(1) & "','" & 
strRowData(6) & "','" & strRowData(7) & "','" & strRowData(8) & "')" 
                    cmd.Connection = con 
                    effectedRow = cmd.ExecuteNonQuery() 

thanks, 
Jonathan 


 

 

This communication may contain information that is legally proprietary, 
confidential, or exempt from disclosure.  If you are not the intended 
recipient, please note that any dissemination, distribution, use or copying of 
this communication is strictly prohibited.  Anyone who receives this message in 
error should notify the sender immediately by telephone +62-21-52961529 or by 
return e-mail and delete it from his or her computer.

Kirim email ke