CS0029:无法将类型'int'隐式转换为'string'此错误显示ON = -S.INSERT(“INSERTTBLEMPLOYEEDETAIL”)请解除此错误 [英] CS0029: Cannot implicitly convert type 'int' to 'string' THIS ERROR DISPLAY ON =-S.INSERT("INSERTTBLEMPLOYEEDETAIL") PLEASE SLOVE THIS ERROR

查看:291
本文介绍了CS0029:无法将类型'int'隐式转换为'string'此错误显示ON = -S.INSERT(“INSERTTBLEMPLOYEEDETAIL”)请解除此错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

protected void btnsave_Click1(object sender,EventArgs e)

{

assignvalues();



{

x = s.insert(inserttblemployeedetail);

if(x> 0)

{

Interaction.MsgBox(已保存);

}

其他

{

Interaction.Msgbox(未保存);

}

}

}

protected void btnsave_Click1(object sender, EventArgs e)
{
assignvalues();

{
x = s.insert("inserttblemployeedetail");
if (x > 0)
{
Interaction.MsgBox("Saved");
}
else
{
Interaction.Msgbox("Not Saved");
}
}
}

推荐答案

check x的数据类型。它看起来像insert方法返回int并且你试图将它存储在字符串中
check data types for x. it looks like insert method is returning int and you are trying to store it in string


因为insert函数返回类型与变量x不匹配..
Because insert function return type not match with variable x..


该消息解释了错误。如果您尝试将整数值存储在字符串中,则此错误非常明显。



The message explains the error. This error quite obvious if you are trying to store an Integer Value in an string.

关注是你的代码中的检查点:
Following are checkpoint here in your code:

1。如果 s.insert 返回整数那么变量 x 应该是一个整数

2.如果 s.insert 返回字符串然后变量 x 应为字符串

1. If s.insert is returning Integer then variable x should be an Integer.
2. If s.insert is returning String then variable x should be a String.







试试这个:




Try this:

int x = s.insert("inserttblemployeedetail");
if (x > 0)
{
    Interaction.MsgBox("Saved");
}
else
{
    Interaction.Msgbox("Not Saved&");
}







- Amit


这篇关于CS0029:无法将类型'int'隐式转换为'string'此错误显示ON = -S.INSERT(“INSERTTBLEMPLOYEEDETAIL”)请解除此错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆