Exemplo n.º 1
0
 private void FillInProperty(PropertyInfo property, int ordinal, SqlCeUpdatableRecord record, object value)
 {
     if (value.GetType() == typeof(bool))
     {
         record.SetBoolean(ordinal, (bool)value);
     }
     else if (value.GetType() == typeof(Int16))
     {
         record.SetInt16(ordinal, (Int16)value);
     }
     else if (value.GetType() == typeof(Int32))
     {
         record.SetInt32(ordinal, (Int32)value);
     }
     else if (value.GetType() == typeof(Int16))
     {
         record.SetInt64(ordinal, (Int16)value);
     }
 }
Exemplo n.º 2
0
        private static void SetData(SqlCeUpdatableRecord rec, int index, Type type, TypeConvertableWrapper col)
        {
            switch (Type.GetTypeCode(type.GetType()))
            {
            case TypeCode.String:
                rec.SetString(index, col.String);
                break;

            case TypeCode.Int16:
                rec.SetInt16(index, col.Int16);
                break;

            case TypeCode.Int32:
                rec.SetInt32(index, col.Int);
                break;

            case TypeCode.Int64:
                rec.SetInt64(index, col.Int);
                break;

            case TypeCode.Byte:
                rec.SetSqlByte(index, col.Byte);
                break;

            case TypeCode.DateTime:
                rec.SetSqlDateTime(index, col.DateTime);
                break;

            case TypeCode.Decimal:
                rec.SetDecimal(index, col.Decimal);
                break;

            default:
                throw new ArgumentException(Type.GetTypeCode(type.GetType()).ToString() + "型には対応していません。");
            }
        }