我正在通过数组更新数据库中的值,但它仅将数组中的最后一个值更新到所有行。我究竟做错了什么?
在 .cs 文件中
BL_HotelDetails hd1 = new BL_HotelDetails();
string[] strResult = strObj.Split(',');
hd1.updateintoRoomNames(hid, strResult);
在业务逻辑层
public void updateintoRoomNames(int hid, string[] strResult)
{
    DA_HotelDetails hd2 = new DA_HotelDetails();
    hd2.updateintoRommNamesDA(hid,strResult);
}
在数据访问层
public void updateintoRommNamesDA(int hid, string[] strResult)
{
    foreach (string s in strResult) 
    {
        Connection concls = new Connection();
        SqlCommand cmd = new SqlCommand();
        string instr = "update tblRoomNames set roomnames='" + s + "' where hid=" + hid + "";
        concls.opencon();
        cmd.CommandText = instr;
        concls.executenonquery(cmd);
        concls.closecon();
    }
}