-1

我正在尝试将会话添加到我网站中的标签,然后将保存在标签中的数字保存回数据库。会话称为customerID

我一直在尝试通过这样做来调用会话

int vv = (int)Session["customerID"]
Label7.Text = vv; 
//I know this doesn't work but can't work out what I need to make the label display the variable.

然后我试图像这样将它保存回数据库

newCarsRow.CustomerID = Convert.ToInt32(Label7.Text.Trim());

我的问题是如何让标签显示保存的 intcustomerID

4

1 回答 1

2
string vv = Session["customerID"].ToString();
Label7.Text = vv;

您不能使 int 等效于 Label 的 Text 属性。

于 2013-05-13T19:56:31.007 回答