错误:分配的左侧必须是变量,属性或索引器 [英] error:the left hand side of an assignment must be a variable , property or indexer
本文介绍了错误:分配的左侧必须是变量,属性或索引器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
error CS0131: The left-hand side of an assignment must be a variable, property or indexer
在下面的行中,我得到了错误:
error CS0131: The left-hand side of an assignment must be a variable, property or indexer
in the below line i am getting the error:
SqlDataAdapter da = new SqlDataAdapter("Select CustName from offsale.OS_forsalelogin where email='" + Session["user1"] = textName.Text.ToString() + "'", util.sql_con);
请尽快帮助我...
添加了代码块[/编辑]
please help me with this soon ...
Code block added[/Edit]
推荐答案
您需要将代码更改为此:
Hi,
You need to change your code into this:
SqlDataAdapter da = new SqlDataAdapter("Select CustName from offsale.OS_forsalelogin where email='" + (Session["user1"] = textName.Text.ToString()) + "'", util.sql_con);
提示也:
我认为textName
是一个文本框,因此变量Text
已经是一个string
.因此,您无需调用ToString
方法.
希望这会有所帮助.
A tip also:
I think textName
is a text box, so the variable Text
is a string
already. So, you don''t need to invoke the ToString
method.
Hope this helps.
这篇关于错误:分配的左侧必须是变量,属性或索引器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文