Hello there,

I have a program that calculates several different Maths functions. There is an SQL database on the back-end which records the name of the user, the name of the math function they use, and the date.

I would like to return and display all of the rows where one particular username is featured. So, if a user has used the system 5 times, 5 rows could be displayed in a datagrid on my form.

I understand that I need to make the SQL connection, use the correct SQL statement, and use an Data Adapter to hold the data and then put it into a dataset. Thing is, I have no idea how to do this!

Don't suppose anyone could shed any light on this?

SQL code I have so far is: (its being hosted by WCF)

Code:
Public Function DatabaseSearch(ByVal UserName As String) As Boolean Implements SearchServiceContract.DatabaseSearch
        Dim connection As SqlConnection
        Dim command As SqlCommand
        Dim query As String
        Dim connStringBuild As New SqlConnectionStringBuilder

        Try
            connStringBuild.DataSource = "BUSDEV"
            connStringBuild.InitialCatalog = "Northwind"
            connStringBuild.UserID = "vbasic"
            connStringBuild.Password = "*******"

            query = "SELECT * FROM WCFTrigNP WHERE username = '" & UserName & "'"
            connection = New SqlConnection(connStringBuild.ConnectionString)
            command = New SqlCommand(query, connection)


            connection.Open()
            command.ExecuteNonQuery()

        Catch ex As Exception
            Return False

        End Try

        Return True
    End Function
Thanks guys