刚才的写错了
protected void btchaxun_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConStr"]);
conn.Open();
SqlCommand mycommand = new SqlCommand("select count(*) from commoditylist where goodsno ='" + huohao + "'", conn);
//int count = Convert.ToInt32(mycommand.ExecuteScalar());
if (count > 0)
{
//SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConStr"]);
// conn.Open();
SqlDataAdapter comm = new SqlDataAdapter("select * from commoditylist where goodsno= " + Convert.ToInt32(huohao.Text), conn);
DataSet dc = new DataSet();
comm.Fill(dc, "commoditylist");
dr = dc.Tables["commoditylist"].Rows[0];
pinming.Text = dr["hname"].ToString();
guige.Text = dr["specifications"].ToString();
chandi.Text = dr["origin"].ToString();
DropDownList1.SelectedItem.Text = dr["categories"].ToString();
jinhuojia.Text = dr["stockprice"].ToString();
xiaoshoujia.Text = dr["saleprice1"].ToString();
zuidishoujia.Text = dr["minimumsaleprice"].ToString();
kucunxiaxian.Text = dr["kcxx"].ToString();
beizhu.Text = dr["note"].ToString();
}
else
{
lb1.Text = "查无此货";
}
}