下面的select语句不带参数就没问题,带参数就出错,提示必须声明变量 '@rmno'
搞不清楚传参数要怎么赋值?
private void button3_Click(object sender, EventArgs e)
{
SqlParameter[] parameters = {
new SqlParameter("@rmno", SqlDbType.NVarChar)};
rmno = this.brmno.Text;
parameters[0].Value = rmno;
string tempStrSQL = "select GuestCurrentID, RoomCode from v_fd_GuestSigns where RoomCode = @rmno";
DataTable tempDataTable = link.SelectDataBase(tempStrSQL);
this.dataGridView1.AutoGenerateColumns = false;
this.dataGridView1.DataSource = tempDataTable;
DataView ds = tempDataTable.DefaultView;
}
private string _rmno;
public string rmno
{
set { _rmno = value; }
get { return _rmno; }
}
[此贴子已经被作者于2007-10-27 13:56:05编辑过]