无法将类型“int”隐式转换为“string”

else{DataRowrow=dt.Rows[0];Customercust=newCustomer();cust.Id=(long)row["Id"];cust.Na... else
{
DataRow row = dt.Rows[0];
Customer cust = new Customer();
cust.Id = (long)row["Id"];
cust.Name = (string)row["Name"];
cust.BrithDay =
(DateTime?)SqlHelper.FromDbValue(row["BrithDay"]);
cust.Address = (string)row["Address"];
cust.CustLevel = (int)row["CustLevel"];这里无法将类型“int”隐式转换为“string”
cust.TelNum = (string)row["TelNum"];

DataRow row = table.Rows[i];
Customer customer = new Customer();
customer.Id = (long)row["Id"];
customer.Name = (string)row["Name"];
customer.BrithDay = (DateTime)SqlHelper.FromDbValue(row["BrithDay"]);
customer.CustLevel = (int)row["CustLevel"];这里无法将类型“int”隐式转换为“string”
customer.TelNum = (string)row["TelNum"];
customer.Address = (string)row["Address"];

customers[i] = customer;
展开
 我来答
如烟151
2014-07-05 · TA获得超过107个赞
知道答主
回答量:122
采纳率:100%
帮助的人:112万
展开全部
你的ClassroomBuilding和 ClassroomStep这两个变量类型都是int类型的,而 buildnum和 floor是string类型的,所以不能这样直接赋值。把这两句改成:
classroom.ClassroomBuilding = int.Parse(buildnum);
classroom.ClassroomStep = int.Parse(floor);
或者将ClassroomBuilding和 ClassroomStep这两个变量类型改成string
请采纳答案,支持我一下。
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式