|
数据库中建了一个栏目名称及其编号。想通过dropdownlist选择栏目名称。要是选中的与数据库里头的名称一样。就把栏目编号给TextBox输出、可是遇到数据类型的问题,麻烦各位大大了!
string sqlStr1 = "select * from PredictFactors_Program where 栏目名称=convert(text,'栏目名称')";
SqlCommand mycmd1 = new SqlCommand(sqlStr1, sconn);
mycmd1.Parameters.Add("@栏目名称", SqlDbType.VarChar, 32).Value = this.DropDownList15.SelectedValue;
SqlDataAdapter myDa = new SqlDataAdapter(mycmd1);
DataSet myDs = new DataSet();
myDa.Fill(myDs);
if (myDs.Tables[0].Rows.Count > 0)
{
// GridView1.DataSource = myDs;
TextBox2.Text = myDs.ToString();
}
提示的错误:The data types text and text are incompatible in the equal to operator.
栏目名称是中文。。。谢谢!
|
|