Essentially all you need to do is pass a SQL statement to the server. With SQL Server it would be something like. Not sure what you're using, but it should be similar.. just with some different connection/command objects.
Dim sqlCnn As SqlConnection
Dim sqlCmd As SqlCommand
sqlCnn = New SqlConnection(<connection_string>)
sqlCmd = New SqlCommand(<sql_statement>, sqlCnn)
sqlCmd.Connection = sqlCnn
sqlCmd.CommandText = inSQL
sqlCmd = Nothing
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...