The class should support a function named Profiles which takes a ID as an Integer parameter and returns the name corresponding to that ID as a String. If the name is NULL, then the function should simply return an empty string (String.Empty). If the ID does not exist in the database, the program should throw an ArgumentException (this class is defined in the System namespace).

Public Sub Profiles(ByVal ID As Integer)
        Dim cmd As New SqlCommand("SELECT ID FROM Biodata WHERE ID = @pid", Info)
        Dim da As New SqlDataAdapter(cmd)
        Dim dt As New DataTable

        cmd.Parameters.Add("pid", SqlDbType.Int)


        If txtName.text = 0 Then
            txtName.text = String.Empty

        End If


        If Count <> 0 Then RaiseEvent CountChanged(Me, New EventArgs)
        If Average <> 0 Then RaiseEvent AverageChanged(Me, New EventArgs)

i dont know how to extract infor from that database and use in

ID is the Primary key in SQL database"Biodata"...when i enter the id number it should get the rest of the Row's values and display..

any idea, tips......???

May be this code can help you.

Dim _table As New DataTable()
Dim _connection As New SqlConnection(mConnectionString)
Dim _commandText As String = "SELECT ID FROM Biodata WHERE ID = @pid"
Dim _adapter As New SqlDataAdapter()
Dim _string As String = String.Empty

With _adapter
.SelectCommand = New SqlCommand(_commandText, _connection)
.SelectCommand.Parameters.Add("@pid", SqlDbType.Int)
.SelectCommand.Parameters(0).Value = id

If _table.Rows.Count = 0 Then
Throw New System.Exception("Null value")
_string = "Yes"
End If
Catch ex As Exception
_string = ex.Message
End Try
End With

This article has been dead for over six months. Start a new discussion instead.