How to deal with null values in C# from Access DB? -
this question has reply here:
removing commas string after using string.join convert array string (c#) 8 answersin c# form have address field in need fill address doorno, street, area, location stored separately in access database. used string concatenation merge total address.
object row = cbl_customer_name.properties.getdatasourcerowbykeyvalue(cbl_customer_name.editvalue) object; string getblocation = (row datarowview)["blocation"].tostring(); string getbcity = (row datarowview)["bcity"].tostring(); string getbstate = (row datarowview)["bstate"].tostring(); string getbcountry = (row datarowview)["bcountry"].tostring(); txe_invoice_address.text = (row datarowview)["bflatno"].tostring() + ", " + (row datarowview)["bpremises"].tostring() + "," + system.environment.newline + (row datarowview)["bstreet"].tostring() + ", " + getloction(getblocation) + "," + system.environment.newline + (row datarowview)["barea"].tostring() + ", " + getcity(getbcity) + "," + system.environment.newline + getstate(getbstate) + ", " + getcountry(getbcountry) + "."; if user come in finish address no problem in above code. if doesn't come in location or other fields getting , , or blank space in end of line. how solve ? need perfect address in address field if user leave 1 or 2 fields also.
use .replace() replace empty values custom text.
example
txe_invoice_address.text = txe_invoice_address.text.replace(", ,", ", ")
this code remove , , may cause unusual adress format.
c# ms-access null
No comments:
Post a Comment