Hello everybody,
My question isn't so much that I am having a problem but rather a check to see if I am using the best ways to populate controls on a windows form.
Right now I retrieve a single record using a oledbdatareader (or sqldatareader depending on the database I use).
An example code is shown below. And it works. But I was wondering if this is the best and fastest way.
Thanks in advance for every input.Code:Private Sub vuldetails() Dim strvuldetails_sql As String = String.Format("SELECT BTW_ID,Code,Percentage,IsActief " & _ "FROM tblBTW " & _ "WHERE BTW_ID = {0}", intGeselecteerdeBTW) Dim cmdvuldetails As New OleDbCommand(strvuldetails_sql, connection) connection.Open() Dim reader As OleDbDataReader = cmdvuldetails.ExecuteReader While reader.Read() Me.txtID.Text = reader("BTW_ID").ToString Me.txtBtwCode.Text = reader("Code").ToString Me.txtPercentage.Text = reader("Percentage").ToString chkIsActief.Checked = CBool(reader("IsActief")) blnIsActief = CBool(reader("IsActief")) End While reader.Close() connection.Close() cmdvuldetails.Dispose() cmdvuldetails = Nothing End Sub


Reply With Quote


