有2个小的问题:
1.判断dropdownlist里的value值总是写不对,代码如下:
if (DropDownList76.SelectedValue == Convert.ToString(10))
曾经尝试把等号两边都转化成int型的,不行,现在还是不行求教高手怎么解决2.想把dropdownlist里的selecteditem选择为数据库里某一列的名称(红体字为关键字)
string strdw =DropDownList76.SelectedItem; SqlConnection con = new SqlConnection("Server=.;database=Login;uid=sa;pwd=179425532;");
try
{
con.Open();
string str = "update wenhua_mei_score set strdw='" + a + "'where zbid='" + i + "'";运行报错说strdw无效,请问怎样才能实现
1.判断dropdownlist里的value值总是写不对,代码如下:
if (DropDownList76.SelectedValue == Convert.ToString(10))
曾经尝试把等号两边都转化成int型的,不行,现在还是不行求教高手怎么解决2.想把dropdownlist里的selecteditem选择为数据库里某一列的名称(红体字为关键字)
string strdw =DropDownList76.SelectedItem; SqlConnection con = new SqlConnection("Server=.;database=Login;uid=sa;pwd=179425532;");
try
{
con.Open();
string str = "update wenhua_mei_score set strdw='" + a + "'where zbid='" + i + "'";运行报错说strdw无效,请问怎样才能实现
2.有那个表吗?
if (DropDownList76.SelectedValue.trim().equals("10"))
2.string str = "update wenhua_mei_score set strdw='" + a + "' where zbid='" + i + "'";
列名是否正确?
可能你需要去除空格.
string str = "update wenhua_mei_score set " + strdw + "='" + a.ToString() + "'where zbid='" + i.ToString() + "'"