Hi Guys,
I'm writing a front end to a database, presenting options as comboboxes. And I need to be able to return nulls to the database.
I have a solution at the moment which involves 'fudging' a record into the query to populate the Datatable, then detecting the selection and hard coding null
into my update statement if this item has been selected.
--GetDataByAvailableTechs query
SELECT tblLEMSCredentialsId, TechNumber
FROM tblLEMSCredentials AS aLEMSCreds
UNION ALL
SELECT '99999' AS Expr1, '<NONE>' AS Expr2
.
//populate combo box
BV_LEMSHIPDataSet.tblLEMSCredentialsDataTable dtAvailableTechs = taLEMSCreds.GetDataByAvailableTechs(selectedSerial);
cboTechNumber.DataSource = dtAvailableTechs;
.
//Save back to DB
if (lemsCredsID == 99999)
{
taDevice.UpdateQuery_Restage(null, selectedSerial);
}
else
{
taDevice.UpdateQuery_Restage(lemsCredsID, selectedSerial);
}
Can anyone suggest a better way of doing this please? I need to make the application cope with another 5 similar fields and don't want to create a multitude of if else versions of my update.
G