public void CreateParameters(ParamStruct[] param) { if (param != null) { int intParamLength = param.Length; idbParameters = new IDbDataParameter[intParamLength]; idbParameters = DBManagerFactory.GetParameters(this.ProviderType, intParamLength); for (int i = 0; i <= intParamLength - 1; i++) { ParamStruct ps = param[i]; IDbDataParameter pm = DBManagerFactory.GetParameter(this.ProviderType); pm.ParameterName = ps.ParameterName; pm.Value = ps.Value; pm.Direction = ps.Direction; pm.DbType = ps.DbType; pm.SourceColumn = ps.SourceColumn; idbParameters[i] = pm; } } }
public ParamStruct SetDBType(ParamStruct pmi, string FieldType) { switch (FieldType) { case "bigint": pmi.DbType = DbType.UInt64; break; case "binary": pmi.DbType = DbType.Binary; break; case "char": pmi.DbType = DbType.String; break; case "datetime": pmi.DbType = DbType.DateTime; break; case "decimal": pmi.DbType = DbType.Decimal; break; case "float": pmi.DbType = DbType.Double; break; case "int": pmi.DbType = DbType.Int32; break; case "nchar": pmi.DbType = DbType.String; break; case "ntext": pmi.DbType = DbType.String; break; case "nvarchar": pmi.DbType = DbType.String; break; case "real": pmi.DbType = DbType.Double; break; case "smalldatetime": pmi.DbType = DbType.DateTime; break; case "smallint": pmi.DbType = DbType.Int32; break; case "text": pmi.DbType = DbType.String; break; case "tinyint": pmi.DbType = DbType.Int16; break; case "System.varchar": pmi.DbType = DbType.String; break; default: pmi.DbType = DbType.String; break; } return(pmi); }