0

Hi all,

I've been using this type of code to pull out a single value from my SQL database but I can't help thinking that there's a simple command I'm not using:

strSQL = "SELECT MAX(Stage) FROM Visits WHERE ScheduleRef = 22"
        FinalStage = dl.getPRISMdata(strSQL).Tables(0).Rows(0).Item(0)
Public Function getPRISMdata(ByVal strSQL As String) As DataSet

        Dim conn As New SqlConnection(ConnectionStringPRISM)
        Dim ds As New DataSet

        conn.Open()

        Dim da As New SqlDataAdapter(strSQL, ConnectionStringPRISM)
        da.Fill(ds)
        Return ds


    End Function

It's the tables(0).rows(0).item(0) that bothers me. It works, but should I be doing something different here? Something more efficient in the function perhaps?

Thanks!

2
Contributors
2
Replies
3
Views
4 Years
Discussion Span
Last Post by Paradox 99
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.