Click here to Skip to main content
15,891,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

How to import data from CSV file into DB2 database table using VB6.0, I used below code but getting error. Please help me.


Dim cnn As New ADODB.Connection
Dim strSQL As String
Dim path As String
DBCONSRT = "Driver={IBM DB2 ODBC DRIVER};Database=dbname;hostname=remoteserver;port=3700;protocol=TCPIP; uid=issspcp; pwd=password;
Set cnn = CreateObject("ADODB.Connection")
cnn.ConnectionString = DBCONSRT
cnn.Open

path = txtSSFile.Text
strSQL = "BULK INSERT sspc.tempdata2 FROM '" & path & _
"' WITH ( FIELDTERMINATOR = '|', ROWTERMINATOR = '\n',DATAFILETYPE = 'native')"

cnn.Execute strSQL

cnn.Close

Set cnn = Nothing
Posted
Comments
sreeyush sudhakaran 8-Oct-15 2:35am    
what is your error please mention...
CHill60 25-Oct-15 19:27pm    
If you are still having problems with this then reply to this comment with details of the error message

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900