Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21246

Split data help

$
0
0
Hi, Usually i used to transfer data from Excell multible column to access db. Now i have data in one column seperated by , as mention below. Please what should i change in code below to transfer data from excel to access db? or please advice me how to do it? i appreciate your help in advance.
Excel sheet data:
In column A,
Code:

B,Brss,4645656,basmoh,6565,failed
Code
Code:

'
'
If rs1.Fields(1) <> vbNullString Then
        strSQLSELECT = "SELECT COUNT(*) AS recCount FROM " & strTable1 & " WHERE "
        strSQLSELECT = strSQLSELECT & "colname = '" & rs1.Fields(0) & "' AND "
        strSQLSELECT = strSQLSELECT & "colnumber = '" & rs1.Fields(0) & "' AND "
        strSQLSELECT = strSQLSELECT & "colICCID = '" & rs1.Fields(0) & "' AND "
        strSQLSELECT = strSQLSELECT & "colstatus ='" & Trim$(rs1.Fields(0)) & "',") & "'"
        rs2.Open strSQLSELECT, cnn, adOpenStatic, adLockOptimistic
        If rs2![recCount] = 0 Then
            strSQL = " (colname,colnumber,colICCID,colstatus) VALUES("
            strSQL = strSQL & "'" & rs1.Fields(1) & "',"
            strSQL = strSQL & "'" & rs1.Fields(2) & "',"
            strSQL = strSQL & "'" & rs1.Fields(3) & "',"
            strSQL = strSQL & "'" & Trim$(rs1.Fields(4)) & "')"
            cnn.Execute strSQl1 & strTable1 & strSQL
            cnn.Execute strSQl1 & strTable2 & strSQL
        End If
'
'


Viewing all articles
Browse latest Browse all 21246

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>