0

I'm using VB 2008 to access data from multiple databases, SQL Server and Access. For this query, I'm pulling data from an SQL table named "People" and displaying the results in ListView1. The "Time" column is in seconds. I have a function I use to convert seconds to minutes and seconds but I'm having a hard time merging the functions where when I pull the data from the database, populate the Name column in the listview and then run the conversion calculation on the seconds, then populate the Time column with the converted time.

    strsql = "SELECT Name, Time from People WHERE Boss ='" & BossSelector1.Text & "'"
    'Connection

    Dim ds As New DataSet
    ListView1.Items.Clear()
    While (dr.Read())
        With ListView1.Items.Add(dr("Name"))
            .subitems.add(dr("Time"))
        End With
    End While

Time Conversion Code

    Dim iSecond As Double = inputtime.Text
    Dim iSpan As TimeSpan = TimeSpan.FromSeconds(iSecond)
    time.Text = iSpan.Minutes.ToString.PadLeft(2, "0"c) & ":" & _
                        iSpan.Seconds.ToString.PadLeft(2, "0"c)

I only have read only access to the SQL server so I cannot make any stored procedures to take care of my problem.

4

0 回答 0