Beispiel #1
0
 public IDbDataParameter AddParameter(IDbCommand command, string name, object value, Type type)
 {
     if (type == typeof(byte[]))
     {
         SqlCeParameter result = (SqlCeParameter)command.CreateParameter();
         result.ParameterName = name;
         result.Value         = value ?? DBNull.Value;
         result.SqlDbType     = SqlDbType.Image;
         command.Parameters.Add(result);
         return(result);
     }
     return(DBUtils.AddSimpleParameter(command, name, value, type));
 }
Beispiel #2
0
 public IDbDataParameter AddParameter(IDbCommand command, string name, object value, Type type)
 {
     if (type == typeof(byte[]))
     {
         MySqlParameter result = (MySqlParameter)command.CreateParameter();
         result.ParameterName = name;
         result.Value         = value;
         result.MySqlDbType   = MySqlDbType.Blob;
         command.Parameters.Add(result);
         return(result);
     }
     if (type == typeof(Guid))
     {
         MySqlParameter result = (MySqlParameter)command.CreateParameter();
         result.ParameterName = name;
         result.Value         = ((Guid)value).ToByteArray();
         result.MySqlDbType   = MySqlDbType.VarBinary;
         command.Parameters.Add(result);
         return(result);
     }
     return(DBUtils.AddSimpleParameter(command, name, value, type));
 }
 public IDbDataParameter AddParameter(IDbCommand command, string name, object value, Type type)
 {
     if (type == typeof(byte[]))
     {
         SqlCeParameter result = (SqlCeParameter)command.CreateParameter();
         result.ParameterName = name;
         result.Value         = value ?? DBNull.Value;
         result.SqlDbType     = SqlDbType.Image;
         command.Parameters.Add(result);
         return(result);
     }
     // We need to use NText as parameter type, if the value is of "IsCLOB" type.
     if (type == typeof(string) && value != null && IsCLOB((uint)value.ToString().Length))
     {
         SqlCeParameter result = (SqlCeParameter)command.CreateParameter();
         result.ParameterName = name;
         result.Value         = value;
         result.SqlDbType     = SqlDbType.NText;
         command.Parameters.Add(result);
         return(result);
     }
     return(DBUtils.AddSimpleParameter(command, name, value, type));
 }