// That function MUST return the string representation of a parameter. Also, it creates a SqlParameter object and stores it /// <summary> /// Creates a derived IDbDataParameter for the table and fields specified /// </summary> /// <param name="table">Name of the table of the field asscoiated to the param</param> /// <param name="field">Name of the field associated to the parameter</param> /// <param name="nparam">Ordinal position of the parameter (0 is first)</param> /// <param name="tableInfo">Hashtable with the schema of the table</param> /// <param name="stringRep">Representation of the parameter in the SQL String (:param)</param> /// <param name="bOriginalVersion">If true the value of the parameter is bound to the original version of the value in the datarow</param> /// <returns>The newly created parameter object</returns> public IDataParameter CreateParameter(string table, string field, int nparam, Hashtable tableInfo, out string stringRep, bool bOriginalVersion) { stringRep = ":param" + nparam; FieldSchemaInfo fieldInfo = (FieldSchemaInfo)tableInfo[field]; // Creates an Oracle parameter (names :paramX) where X is the ordinal (0-based) OracleParameter param = new OracleParameter(); param.ParameterName = "param" + nparam; param.SourceColumn = field; param.OracleDbType = (OracleDbType)fieldInfo.NativeType; if (fieldInfo.FieldSize != -1) { param.Size = fieldInfo.FieldSize; } if (bOriginalVersion) { param.SourceVersion = DataRowVersion.Original; } return(param); }
// That function MUST return the string representation of a parameter. Also, it creates a SqlParameter object and stores it /// <summary> /// Creates a derived IDbDataParameter for the table and fields specified /// </summary> /// <param name="table">Name of the table of the field asscoiated to the param</param> /// <param name="field">Name of the field associated to the parameter</param> /// <param name="nparam">Ordinal position of the parameter (0 is first)</param> /// <param name="tableInfo">Hashtable with the schema of the table</param> /// <param name="stringRep">Representation of the parameter in the SQL String (@param)</param> /// <param name="bOriginalVersion">If true the value of the parameter is bound to the original version of the value in the datarow</param> /// <returns>The newly created parameter object</returns> public IDataParameter CreateParameter(string table, string field, int nparam, Hashtable tableInfo, out string stringRep, bool bOriginalVersion) { stringRep = "@param" + nparam; FieldSchemaInfo fieldInfo = (FieldSchemaInfo)tableInfo[field]; // Creates a EMPTY parameter (OLEDB params cannot be filled). System.Data.SqlClient.SqlParameter param = new System.Data.SqlClient.SqlParameter(); param.ParameterName = "param" + nparam; param.SourceColumn = field; param.SqlDbType = (System.Data.SqlDbType)fieldInfo.NativeType; if (fieldInfo.FieldSize != -1) { param.Size = fieldInfo.FieldSize; } if (bOriginalVersion) { param.SourceVersion = DataRowVersion.Original; } return(param); }