hey acctually i want to retrive data from text file nd save it to sql database bt i just have to implement some conditions like if there are 3 entries exists in text file with the same ID but i just have to get only 2 of them so in what manner should i write the code....
Dim sbIDs As New System.Text.StringBuilder
Dim sbPunchDateStamp As New System.Text.StringBuilder
Dim sbPunchTimeStamp As New System.Text.StringBuilder
For Each Str As String In My.Computer.FileSystem.ReadAllText(System.IO.Path.GetFullPath(ofd.FileName)).Split(vbCrLf)
If String.IsNullOrEmpty(Str.Trim) Or Str.StartsWith("No") Then Continue For
Dim arr As String() = Str.Trim.Split(" ")
Dim dt As Date = CType(arr(8), Date)
sbIDs.Append(arr(2) & "|")
sbPunchDateStamp.Append(dt.ToString("yyyyMMdd") & "|")
Dim ds_sbPunchTimeStamp As DataSet
sbPunchTimeStamp.Append(dt.ToString("HHmmss") & "|")
Next
Dim sql As String = _appConfig.GetValue("Sql.ConvertRawDataToAttendance")
Dim arrParameters(2) As String
arrParameters(0) = sbIDs.ToString
arrParameters(1) = sbPunchDateStamp.ToString
arrParameters(2) = sbPunchTimeStamp.ToString
_dh.ExecuteNonQuery(sql, CommandType.StoredProcedure, arrParameters)
PopupBox.Show("Attendance Saved succesfully.", "Information", PopupBox.CYButtons.OK, PopupBox.CYIcon.Information)