u can use function Split to separate each parts into fields and insert them into database
hope it will help
While Not EOF(7)
Input #7, InputRead
panjang_rec = Len(InputRead)
arrayRek = Split(InputRead, ";", 8)
temp.path_file = arrayRek(0)
temp.nama_file = arrayRek(1)
temp.nama_penyanyi = arrayRek(2)
temp.judul_lagu = arrayRek(3)
temp.nama_album = arrayRek(4)
temp.genre = arrayRek(6)
temp.durasi = arrayRek(7)
recpos = LOF(15) / reclengtemp + 1
temp.nomor_lagu = recpos
Put #15, recpos, temp
sorry but it was VB6 version, but i it will give u the idea
temp is the structure which contains the record
arrayrek just a buffer variable
hope it works
i have this code
Private Sub Upload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Upload.Click Dim Colsname As String Dim Colscontacts As String Dim oFile As System.IO.File Dim oRead As System.IO.StreamReader Dim ErrClient As Boolean Try oRead = oFile.OpenText("C:\sms_contacts.csv") Catch ex As Exception ErrClient = True MessageBox.Show("Error while retrieving records on table0..." & ex.Message, "Load Records0") Finally End Try Try Do While oRead.Peek <> -1 Dim tmp As String = oRead.ReadLine() If Not tmp = "" Then Dim Cols() As String = Split(tmp, ",") If Cols(0) <> "" Then Colsname = Cols(0) Colscontacts = Cols(1) End If End If Loop Dim objSQLConn As New SqlConnection(objDTCS.GetSQLHeadCountConnectionString) Dim objSQLComm As New SqlCommand Dim SQLStr As String Dim objSQLAdap As New SqlDataAdapter objSQLConn.Open() objSQLComm = objSQLConn.CreateCommand objSQLAdap.SelectCommand = objSQLComm SQLStr = " INSERT INTO sms_contact(name, contacts) Values (" _ & "'" & ("colsname") & "', " _ & "'" & ("colscontacts") & "') " objSQLComm.CommandText = SQLStr objSQLComm.ExecuteNonQuery() objSQLConn.Close() Catch ex As Exception MessageBox.Show("Error while retrieving records on table1..." & ex.Message, "Load Records1") Exit Sub Finally End Try End Sub
im stuck at the insert.i dont know should i put into the values.
Edited 6 Years Ago by lunaluni: n/a
Help! I want to create a java program that finds the highest even integer among the values entered by the user. Stop asking values when a value less than 1 have been entered. If no even integer is entered, display "No Even Integer"
Here is the sample output that I ...
Hello All ...
Iam Getting An Error With try to excecute the stored procedure .
I have Have Sql database , the stored procedure like so :
USE [MPRS] GO /****** Object: StoredProcedure [dbo].[Search_Licenses_By_Number] Script Date: 26-Nov-16 8:06:52 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE ...
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...