Friday, May 10, 2024
Homepage · c#
 Popular · Latest · Hot · Upcoming
187
rated 0 times [  194] [ 7]  / answers: 1 / hits: 10622  / 11 Years ago, wed, january 15, 2014, 12:00:00

I have finish perfectly coding Register Page, Login and now the UpdateCustomer page has errors - Background info : I'm using Microsoft Access as data source



    LabelState.Text = (string)Session[sState];
LabelPostalCode.Text = (string)Session[sPostalCode];
LabelContactNumber.Text = (string)Session[sContactNumber];
LabelEmail.Text = (string)Session[sEmail];
LabelPassword.Text = (string)Session[sPassword];


Everything here is fine except LabelContactNumber.Text = (string)Session[sContactNumber].



I believe it is because only ContactNumber in Access is set as Int the rest is Text therefore there's no error when I use (string).


More From » c#

 Answers
3
LabelContactNumber.Text = (Session[sContactNumber] != null)
? Session[sContactNumber].ToString()
: string.Empty //or whatever default value your want;

[#48680] Tuesday, January 14, 2014, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aidan

Total Points: 72
Total Questions: 95
Total Answers: 121

Location: Uzbekistan
Member since Sat, Feb 27, 2021
3 Years ago
;