private void roomInfoDataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
{
SetEnable();
roomId = Convert.ToInt32(this.roomInfoDataGridView.Rows[e.RowIndex].Cells["dataGridViewTextBoxColumn1"].Value).ToString();
room = RoomInfoManage.GetRoomByRoomId(Convert.ToInt32(roomId));
roomType = RoomTypeManage.GetRoomTypeByTypeID(room.TypeID);
this.Number.Text = room.Number.Trim();
this.GuestNumber.Text = Convert.ToString(room.GuestNumber);
this.BedNumber.Text = Convert.ToString(room.BedNumber);
this.State.Text = room.State.Trim();
this.Description.Text = room.Description;
this.TypeName.Text = roomType.TypeName.Trim();
this.Price.Text = Convert.ToDecimal(roomType.TypePrice).ToString();
}
这是单击datagridview的代码。。运行时没有错误,可是运行时只要点到单元格就会显示无法绑定由多个部分组成的标识符
应该是sql语句有问题,比如有同名字段同时存在两个表中,你没有指定是哪个表的,你还是把涉及到的sql打印出来看看吧
可以断定 GridView绑定的SQL语句,里面没有某个字段,所有点击GridView的时候,取不到这个字段,建议打断点跟踪下程序.