错误-无法在System.Int32和System.String上执行'='操作. [英] Error - Cannot perform '=' operation on System.Int32 and System.String.

查看:68
本文介绍了错误-无法在System.Int32和System.String上执行'='操作.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么在localhost中运行此程序后出现错误.

错误-无法在System.Int32和System.String上执行"="操作.


我的CS程序如下所示

Why the error is comming after running this program in localhost.

Error - Cannot perform ''='' operation on System.Int32 and System.String.


My cs program is given below

void del(Object Sender, EventArgs e)
{
string agent = Request.QueryString["CODNO"];
string sa=txtACode.Text.Trim();
int r=0;
con.Open();
DataRow []rs;
rs=ds.Tables["joining"].Select("agent=''" + sa + "''");
//rs=ds.Tables["joining"].Select("agent=''" + sa + "''");
r=rs.Length;
if (txtACode.Text=="")
{
com=con.CreateCommand();
com.CommandText="delete * from joining where agent=''" + agent + "''";
}
else
{
if(r==0)
{
System.Web.UI.WebControls.Label lbl1=new System.Web.UI.WebControls.Label();
lbl1.ForeColor=System.Drawing.Color.Blue;
lbl1.BackColor=System.Drawing.Color.Yellow;
lbl1.Text="Please enter a velid cerification number to DELETE";
ph1.Controls.Add(lbl1);
}
else if(r>0)
{
DataRow dr;
dr=rs[0];
com=con.CreateCommand();
com.CommandText="delete * from joining where agent=''" + sa + "''";
}
else
{
System.Web.UI.WebControls.Label lbl1=new System.Web.UI.WebControls.Label();
lbl1.ForeColor=System.Drawing.Color.Blue;
lbl1.BackColor=System.Drawing.Color.Yellow;
lbl1.Text="No Such Record Found";
ph1.Controls.Add(lbl1);
}
}
try
{
com.ExecuteNonQuery();
System.Web.UI.WebControls.Label lbl1=new System.Web.UI.WebControls.Label();
lbl1.ForeColor=System.Drawing.Color.Blue;
lbl1.BackColor=System.Drawing.Color.Yellow;
lbl1.Text="Record DELETED";
ph1.Controls.Add(lbl1);
}
catch(Exception ex)
{
}
con.Close();
}

推荐答案

在哪一行中,您会收到该错误.

您可以尝试
In which particular line, you are getting that error.

you can try
string agent = Request.QueryString["CODNO"].ToString();



但是如果您指定行号,那就太好了



but it would be great if you specify the line number


可能是您的数据源的列为空
May be your DataSource have empty column


这篇关于错误-无法在System.Int32和System.String上执行'='操作.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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