0

am developing software using sql database. i want an sql statement that can enable me retrieve data which for example has same surname,save them in an array or dataset and navigate through them.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Oxiegen
0

am developing software using sql database. i want an sql statement that can enable me retrieve data which for example has same surname,save them in an array or dataset and navigate through them.

Private ds As DataSet = Nothing

Private Function CollectData() As Boolean
   Dim con As New SqlConnection("connectionstring")
   Dim da As SqlDataAdapter = Nothing
   ds = New DataSet()
   
   Try
      con.Open()
      da = New SqlDataAdapter("SELECT * FROM table", con)
      da.Fill(ds)
      con.Close()
   Catch ex As Exception
      Return False
   End Try
   Return True
End Function

Private Function FindRecord(Surname As String) As DataRow()
   Dim row() As DataRow

   Try
      row = ds.Tables(0).Select("surname = '" & Surname & "'")
   Catch ex As Exception
      Return Nothing
   End Try
   Return row
End Function

Edited by Oxiegen: n/a

This topic has been dead for over six months. 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.