 |
|
ASP - Insert CSV ลง Table ค่ะ ไม่ต้องการให้ record แรก ที่เป็น header ลงไปใน Table ต้องทำอย่างไรคะ |
|
 |
|
|
 |
 |
|
Insert CSV ลง Table ค่ะ ไม่ต้องการให้ record แรก ที่เป็น header ลงไป ต้องทำอย่างไรคะ
Code (ASP)
Do Until oInStream.AtEndOfStream
sRows = oInStream.readLine
arrRows = Split(sRows,",")
'*** Insert to table customer2 ***'
strSQL = ""
strSQL = strSQL &"INSERT INTO customer2 "
strSQL = strSQL &"(CustomerID,Name,Email,CountryCode,Budget,Used) "
strSQL = strSQL &"VALUES "
strSQL = strSQL &"('"&arrRows(0)&"','"&arrRows(1)&"','"&arrRows(2)&"' "
strSQL = strSQL &",'"&arrRows(3)&"','"&arrRows(4)&"','"&arrRows(5)&"') "
Set objExec = Conn.Execute(strSQL)
Set objExec = Nothing
Loop
Tag : ASP
|
|
 |
 |
 |
 |
Date :
2013-07-08 13:56:03 |
By :
gustey |
View :
1158 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใช้ IF เอาครับ
Code (ASP)
Dim i
Do Until oInStream.AtEndOfStream
sRows = oInStream.readLine
arrRows = Split(sRows,",")
'*** Insert to table customer2 ***'
IF i >= 1 Then
strSQL = ""
strSQL = strSQL &"INSERT INTO customer2 "
strSQL = strSQL &"(CustomerID,Name,Email,CountryCode,Budget,Used) "
strSQL = strSQL &"VALUES "
strSQL = strSQL &"('"&arrRows(0)&"','"&arrRows(1)&"','"&arrRows(2)&"' "
strSQL = strSQL &",'"&arrRows(3)&"','"&arrRows(4)&"','"&arrRows(5)&"') "
Set objExec = Conn.Execute(strSQL)
Set objExec = Nothing
End IF
i = i + 1
Loop
|
 |
 |
 |
 |
Date :
2013-07-08 17:43:27 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|