A
Adam Knight
Hi all,
Just wondering how everybody goes about dealing with db nulls when binding
form controls to db data.
The code below produces an error if any column in the reader object contains
a db null value.
Is their a concise way of getting around this?
Cheers,
Adam
'fill reader object with command results
rdrSupervisorDetails = cmdGetSupervisorDetails.ExecuteReader()
'move to record returned in reader object
rdrSupervisorDetails.Read()
'populate form with values retrieve from db
txtFirstName.Text = CStr(rdrSupervisorDetails("first_name"))
txtLastName.Text = rdrSupervisorDetails("last_name")
txtDepartment.Text = rdrSupervisorDetails("department")
txtEmail.Text = rdrSupervisorDetails("email")
txtPhone.Text = rdrSupervisorDetails("phone")
txtMobile.Text = rdrSupervisorDetails("mobile")
'close & destroy db connection
Conn.Close()
Conn = Nothing
Just wondering how everybody goes about dealing with db nulls when binding
form controls to db data.
The code below produces an error if any column in the reader object contains
a db null value.
Is their a concise way of getting around this?
Cheers,
Adam
'fill reader object with command results
rdrSupervisorDetails = cmdGetSupervisorDetails.ExecuteReader()
'move to record returned in reader object
rdrSupervisorDetails.Read()
'populate form with values retrieve from db
txtFirstName.Text = CStr(rdrSupervisorDetails("first_name"))
txtLastName.Text = rdrSupervisorDetails("last_name")
txtDepartment.Text = rdrSupervisorDetails("department")
txtEmail.Text = rdrSupervisorDetails("email")
txtPhone.Text = rdrSupervisorDetails("phone")
txtMobile.Text = rdrSupervisorDetails("mobile")
'close & destroy db connection
Conn.Close()
Conn = Nothing