Example #1
0
        private static void ExecuteUpdate(ISession session, string sql, object[][] dataTable)
        {
            for (int i = 0; i < dataTable.GetLength(0); i++)
            {
                IQuery query = session.CreateSQLQuery(sql);

                for (int j = 0; j < dataTable[i].GetLength(0); j++)
                {
                    object objValue = dataTable[i][j];

                    if (objValue == null)
                    {
                        //Workaround: cant set NULL value for int type
                        query.SetBinary(j, null);
                    }
                    else
                    {
                        query.SetParameter(j, objValue);
                    }
                }

                query.ExecuteUpdate();
            }
        }