protected DbParameter genParameter(String paramName, OleDbType type, int size, Object value) { if (value == null) value = DBNull.Value; DbParameter param = null; if (type == OleDbType.DBTimeStamp) { if (value == DBNull.Value) { param = new OleDbParameter(paramName, value); } else { param = new OleDbParameter(paramName, ((Nullable<DateTime>)value).Value); } } else { param = new OleDbParameter(paramName, type, size); param.Value = value; } return param; }
public static OleDbParameter AddOutParamToSqlCommand(OleDbCommand comm, string pName, OleDbType pType) { OleDbParameter param = new OleDbParameter(pName, pType); param.Direction = ParameterDirection.Output; comm.Parameters.Add(param); return param; }
/// <summary> /// Returns the matching DBType for this OleDBtype /// </summary> /// <param name="type">OleDbType to convert</param> /// <returns>Corresponding DbType</returns> public static DbType GetDbType(OleDbType type) { if (!typeLookup.ContainsKey(type)) return default(DbType); // Default is ANSIString = 0 return typeLookup[type]; }
private void button2_Click(object sender, EventArgs e) { if (isNumber(tbSwim.Text.Trim())) { string name = "PACK_BANKNET.Proc_ExceptionHold_Comeback"; string[] InParaName = new string[1] { "v1_swim_id" }; string[] OutParaName = new string[1] { "v2_out_ret" }; OleDbType[] InParaType = new OleDbType[1] { OleDbType.Numeric }; OleDbType[] OutParaType = new OleDbType[1] { OleDbType.Numeric }; string[] InParaValues = new string[1] { tbSwim.Text.Trim() }; string[] OutParaValues = new string[1]; for (int i = 0; i < 1; i++) OutParaValues[i] = ""; int[] OutParaSize = new int[1] { 0 }; string err = ""; this.Cursor = Cursors.WaitCursor; Businessbp.executedb.ExecuteProcTCBS(name, InParaName, InParaType, InParaValues, OutParaName, OutParaType, OutParaSize, ref OutParaValues, ref err); this.Cursor = Cursors.Default; if (err != "") MessageBox.Show(err); else { if (OutParaValues[0].ToString() == "-1") { MessageBox.Show("Proccess unsuccessful."); } else { MessageBox.Show("Proccess successful."); } } } else MessageBox.Show("Invalid swim id"); }
private void button2_Click(object sender, EventArgs e) { string name = "PACK_BANKNET.Proc_Release"; string[] InParaName = new string[1] { "v1_swim_id" }; string[] OutParaName = new string[1] { "v2_out_ret" }; OleDbType[] InParaType = new OleDbType[1] { OleDbType.Numeric }; OleDbType[] OutParaType = new OleDbType[1] { OleDbType.Numeric }; string[] InParaValues = new string[1] { swim_id }; string[] OutParaValues = new string[1]; for (int i = 0; i < 1; i++) OutParaValues[i] = ""; int[] OutParaSize = new int[1] { 0 }; string err = ""; this.Cursor = Cursors.WaitCursor; Businessbp.executedb.ExecuteProcTCBS(name, InParaName, InParaType, InParaValues, OutParaName, OutParaType, OutParaSize, ref OutParaValues, ref err); this.Cursor = Cursors.Default; if (err != "") MessageBox.Show(err); else { if (OutParaValues[0].ToString() == "-1") { tbStatus.Text = "Release unsuccessful."; MessageBox.Show("Release unsuccessful."); } else { tbStatus.Text = "Release successful."; MessageBox.Show("Release successful."); button2.Enabled = false; } } }
public OleDbField(int tableIndex, string fieldName, OleDbType dataType, bool visible) { this.tabIndex = tableIndex; this.fldName = fieldName; this.dbType = dataType; this.visible = visible; }
public ExecuteSqlParameter(string name, string variableName, ParameterDirections direction, OleDbType oleDBType, int length) { Name = name; VariableName = variableName; Direction = direction; OleDBType = oleDBType; Length = length; }
public OleDbParameter AddParameter(string ParameterName, OleDbType type, int size, object value, ParameterDirection direction) { OleDbParameter param = new OleDbParameter(ParameterName, type, size); param.Direction = direction; param.Value = value; Command.Parameters.Add(param); return param; }
private void button2_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; string sql = "", err1 = ""; DataTable dt; string name = Businessbp.executedb.owner + "proc_check88"; // proc_check88( //fromdate in varchar2, //todate in varchar2, //r_count out number, //Result_out out number, //Emsg_out out varchar2) string FromDate = "", ToDate = ""; FromDate = dtFrom.Text + " " + tbFhh.Text + ":" + tbFmi.Text + ":" + tbFss.Text; ToDate = dtTo.Text + " " + tbThh.Text + ":" + tbTmi.Text + ":" + tbTss.Text; string[] InParaName = new string[2] { "fromdate", "todate" }; string[] OutParaName = new string[3] { "r_count", "Result_out", "Emsg_out" }; OleDbType[] InParaType = new OleDbType[2] { OleDbType.VarChar, OleDbType.VarChar }; OleDbType[] OutParaType = new OleDbType[3] { OleDbType.Numeric, OleDbType.Numeric, OleDbType.VarChar }; string[] InParaValues = new string[2] { FromDate, ToDate }; string[] OutParaValues = new string[3]; for (int i = 0; i < 3; i++) OutParaValues[i] = ""; int[] OutParaSize = new int[3] { 0 , 0 , 300 }; string err = ""; Businessbp.executedb.ExecuteProcELECTRA(name, InParaName, InParaType, InParaValues, OutParaName, OutParaType, OutParaSize, ref OutParaValues, ref err); if (err != "") MessageBox.Show(err); else { int r_count = Int32.Parse(OutParaValues[0].ToString()); int Result_out = Int32.Parse(OutParaValues[1].ToString()); string Emsg_out = OutParaValues[2].ToString(); if (Result_out != 1) { MessageBox.Show(Emsg_out); return; } else { MessageBox.Show("Process successfull!!!"); LoadData(); } } this.Cursor = Cursors.Default; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public static bool IsOleDbTypeValidForIDCol(OleDbType ot) { if (ot == OleDbType.Integer || ot == OleDbType.BigInt || ot == OleDbType.SmallInt || ot == OleDbType.TinyInt || ot == OleDbType.Guid) return true; else return false; }
public ColumnDefinition(String name, bool primaryKey, bool foreignKey, bool unique, bool nullable, OleDbType type) { _name = name; _primaryKey = primaryKey; _foreignKey = foreignKey; _unique = unique; _nullable = nullable; _type = type; }
public ColumnInfo(string name, long ordinalPosition, OleDbType dbType, long? characterMaxLength, int? numericPrecision, int? numericScale, bool isPrimaryKey = false) { Name = name; OrdinalPosition = ordinalPosition; DbType = dbType; CharacterMaxLength = characterMaxLength; NumericPrecision = numericPrecision; NumericScale = numericScale; IsPrimaryKey = isPrimaryKey; }
private void Process() { try { this.Cursor = Cursors.WaitCursor; string name = ""; const int out_para = 2; name += "" + Businessbp.executedb.owner + "proc_nab_thucno"; //string type = "Pre_Transaction_Upload"; string in_parameter = ""; string[] InParaName = new string[1] { "user_id" }; string[] OutParaName = new string[out_para] { "Result_out", "Emsg_out" }; OleDbType[] InParaType = new OleDbType[2] { OleDbType.VarChar, OleDbType.VarChar }; OleDbType[] OutParaType = new OleDbType[out_para] { OleDbType.Numeric, OleDbType.VarChar}; string[] InParaValues = new string[1] { Businessbp.executedb.Usrid }; string[] OutParaValues = new string[out_para]; for (int i = 0; i < out_para; i++) OutParaValues[i] = ""; int[] OutParaSize = new int[out_para] { 0, 500}; string err = ""; Businessbp.executedb.ExecuteProcELECTRA(name, InParaName, InParaType, InParaValues, OutParaName, OutParaType, OutParaSize, ref OutParaValues, ref err); if (err != "") { MessageBox.Show(err); this.Cursor = Cursors.Default; return; } else { int Result_out = Int32.Parse(OutParaValues[0].ToString()); string Emsg_out = OutParaValues[1].ToString(); if (Result_out != 1) { MessageBox.Show(Emsg_out); tbStatus.Text = Emsg_out; this.Cursor = Cursors.Default; return; } else { //Parse out_parameter nếu cần thiết tbStatus.Text = "Successfull!!!"; MessageBox.Show("Successfull!!!"); } } this.Cursor = Cursors.Default; } catch (Exception ex) { MessageBox.Show(ex.Message); this.Cursor = Cursors.Default; } }
private void btProcess_Click( object sender, EventArgs e ) { try { string type = cbb_type.Text.Trim ( ); //2015-10-20 (1) this.Cursor = Cursors.WaitCursor; string name = Businessbp.executedb.owner + "pro_auto_payment"; //string[] InParaName = new string[1] { "u_create" };//old 2015-10-20 (1) string[] InParaName = new string[1] { "u_create" };//2015-10-20 (1) string[] OutParaName = new string[2] { "Result_out", "Msg_out" }; //OleDbType[] InParaType = new OleDbType[1] { OleDbType.VarChar };//old 2015-10-20 (1) OleDbType[] InParaType = new OleDbType[1] { OleDbType.VarChar };//2015-10-20 (1) OleDbType[] OutParaType = new OleDbType[2] { OleDbType.Numeric, OleDbType.VarChar }; //string[] InParaValues = new string[1] { Businessbp.executedb.Usrid };//old 2015-10-20 (1) string[] InParaValues = new string[1] { Businessbp.executedb.Usrid };// 2015-10-20 (1) string[] OutParaValues = new string[2]; for (int i = 0; i < 2; i++) OutParaValues[i] = ""; int[] OutParaSize = new int[2] { 0, 300 }; string err = ""; Businessbp.executedb.ExecuteProcELECTRA ( name, InParaName, InParaType, InParaValues, OutParaName, OutParaType, OutParaSize, ref OutParaValues, ref err ); if (err != "") { MessageBox.Show ( err ); this.Cursor = Cursors.Default; } else { int Result_out = Int32.Parse ( OutParaValues[0].ToString ( ) ); string Emsg_out = OutParaValues[1].ToString ( ); if (Result_out != 1)//Lỗi { MessageBox.Show ( Emsg_out ); this.Cursor = Cursors.Default; return; } else { //Xu ly hach toan HachToan ( false ); LoadData ( ); tbStatus.Text = "Process successfull!!!"; this.Cursor = Cursors.Default; } } } catch (Exception ex) { MessageBox.Show ( ex.Message ); } }
void SetParameterValue(OleDbParameterCollection Params, object value, OleDbType type) { if (value != null) { Params.Add("?", type).Value = value; } else { Params.AddWithValue("?", DBNull.Value); } }
private static IDataParameter CreateParameter(string parameterName, object parameterValue, OleDbType dbType) { parameterValue = parameterValue ?? DBNull.Value; if (parameterValue is DBNull) { return new OleDbParameter(parameterName, dbType); } return new OleDbParameter(parameterName, parameterValue); }
public OleDbParameter MakeParam(string ParamName, OleDbType DbType, Int32 Size, ParameterDirection Direction, object Value) { OleDbParameter param; if (Size > 0) param = new OleDbParameter(ParamName, DbType, Size); else param = new OleDbParameter(ParamName, DbType); param.Direction = Direction; if (!(Direction == ParameterDirection.Output && Value == null)) param.Value = Value; return param; }
private void button1_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; string sql = "", err1 = ""; DataTable dt; string cycle = cbCycle.SelectedValue.ToString().Trim(); string date_process = dateTimePicker1.Text; string name = Businessbp.executedb.owner + "nab_proc_printbillcr"; // (cycle in varchar2, indate in varchar2, Result_out out number, //Emsg_out out varchar2) is string[] InParaName = new string[2] { "cycle", "indate" }; string[] OutParaName = new string[2] { "Result_out", "Emsg_out" }; OleDbType[] InParaType = new OleDbType[2] { OleDbType.VarChar, OleDbType.VarChar }; OleDbType[] OutParaType = new OleDbType[2] { OleDbType.Numeric, OleDbType.VarChar }; string[] InParaValues = new string[2] { cycle, date_process }; string[] OutParaValues = new string[2]; for (int i = 0; i < 2; i++) OutParaValues[i] = ""; int[] OutParaSize = new int[2] { 0, 300 }; string err = ""; Businessbp.executedb.ExecuteProcELECTRA(name, InParaName, InParaType, InParaValues, OutParaName, OutParaType, OutParaSize, ref OutParaValues, ref err); if (err != "") { MessageBox.Show(err); this.Cursor = Cursors.Default; } else { int Result_out = Int32.Parse(OutParaValues[0].ToString()); string Emsg_out = OutParaValues[1].ToString(); if (Result_out != 1) { MessageBox.Show(Emsg_out); this.Cursor = Cursors.Default; return; } else { MessageBox.Show("Process successful"); } } this.Cursor = Cursors.Default; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void bt_Authorize_Click(object sender, EventArgs e) { string in_parameter = ""; string err = ""; string out_rc = "", out_msg_err = "", out_other_info = ""; const int count_inval = 1; const int count_outval = 3; in_parameter = ""; in_parameter += "<cr_account_number>" + tb_AccNo.Text.Trim() + "</cr_account_number>"; in_parameter += "<user_id>" + Businessbp.executedb.Usrid + "</user_id>"; string name = Businessbp.executedb.owner + "nab_installment.Over_Limit_Installment"; string[] InParaName = new string[count_inval] { "in_parameter" }; OleDbType[] InParaType = new OleDbType[count_inval] { OleDbType.VarChar }; string[] InParaValues = new string[count_inval] { in_parameter }; string[] OutParaName = new string[count_outval] { "out_rc", "out_msg_err", "out_other_info" }; OleDbType[] OutParaType = new OleDbType[count_outval] { OleDbType.VarChar, OleDbType.VarChar, OleDbType.VarChar }; int[] OutParaSize = new int[count_outval] { 2, 100, 9999 }; string[] OutParaValues = new string[count_outval]; err = ""; Businessbp.executedb.ExecuteProcELECTRA(name, InParaName, InParaType, InParaValues, OutParaName, OutParaType, OutParaSize, ref OutParaValues, ref err); if (err != "") { MessageBox.Show(err); } else { out_rc = OutParaValues[0].ToString(); out_msg_err = OutParaValues[1].ToString(); out_other_info = OutParaValues[2].ToString(); if (out_rc != "00") { MessageBox.Show(out_msg_err); } else { tb_AccNo.Enabled = false; string batch_nbr = ""; batch_nbr = out_other_info.Substring(out_other_info.IndexOf("<batch_nbr>") + "<batch_nbr>".Length, out_other_info.IndexOf("</batch_nbr>") - (out_other_info.IndexOf("<batch_nbr>") + "<batch_nbr>".Length)); if (batch_nbr == "") MessageBox.Show("No batch open!!"); else { lb_Success.Text = Count_Success_Fail(Int32.Parse(batch_nbr), "Y").ToString(); lb_Fail.Text = Count_Success_Fail(Int32.Parse(batch_nbr), "Z").ToString(); Load_Data_After(batch_nbr); MessageBox.Show("Process Done!!!"); } } } }
public IntelWebField(string fieldname, OleDbType fieldtype, int fieldsize, byte fieldprecision, byte fieldscale, DataRowVersion fieldversion, bool isnullable, object fieldvalue) { this.name = fieldname; this.type = fieldtype; this.size = fieldsize; this.precision = fieldprecision; this.scale = fieldscale; this.version = fieldversion; this.nullable = isnullable; _fieldValue = fieldvalue; this.previousValue = fieldValue; _isdirty = false; }
public AttributeDefinition(IObjectDefinition od, string name, string label, string column, OleDbType type, int? length, int orderIndex, bool isRequired, bool isReadOnly) { Name = name; Label = label; Column = column; DataType = type; Length = length; OrderIndex = orderIndex; IsRequired = isRequired; ForObject = od; IsReadOnly = isReadOnly; ShowInList = true; }
private void bt_Process_Click(object sender, EventArgs e) { string in_parameter = ""; string err = ""; string out_rc = "",out_msg_err="", out_other_info = ""; const int count_inval = 1; const int count_outval = 3; //string transaction_amount = "", currency_code = "", billing_amount = "", periods = "", card_number = "", reference_number = "", trace = "", card_acceptor_term_id = "", user_id = "", transaction_local_date = "", content = ""; #region Get_Parameter in_parameter = ""; in_parameter += "<microfirm_ref_number>" + tb_Micro_Ref_No.Text.Trim() + "</microfirm_ref_number>"; in_parameter += "<sequence_number>" + int.Parse(tb_Seq_No.Text.Trim()) + "</sequence_number>"; in_parameter += "<client_code>" + tb_CIF.Text.Trim() + "</client_code>"; in_parameter += "<user_id>" + user_id + "</user_id>"; in_parameter += "<content>" + tb_Note.Text.Trim() + "</content>"; in_parameter += "<periods>" + int.Parse(cb_Periods.Text.Trim()) + "</periods>"; #endregion Get_Parameter string name = Businessbp.executedb.owner + "nab_installment.Transfer_to_installment"; string[] InParaName = new string[count_inval] { "in_parameter" }; OleDbType[] InParaType = new OleDbType[count_inval] { OleDbType.VarChar }; string[] InParaValues = new string[count_inval] { in_parameter }; string[] OutParaName = new string[count_outval] { "out_rc", "out_msg_err", "out_other_info" }; OleDbType[] OutParaType = new OleDbType[count_outval] { OleDbType.VarChar, OleDbType.VarChar, OleDbType.VarChar }; int[] OutParaSize = new int[count_outval] { 2, 100, 9999 }; string[] OutParaValues = new string[count_outval]; err = ""; Businessbp.executedb.ExecuteProcELECTRA(name, InParaName, InParaType, InParaValues, OutParaName, OutParaType, OutParaSize, ref OutParaValues, ref err); if (err != "") { MessageBox.Show(err); } else { out_rc = OutParaValues[0].ToString(); out_msg_err = OutParaValues[1].ToString(); out_other_info = OutParaValues[2].ToString(); if (out_rc != "00") { MessageBox.Show(out_msg_err); } else { MessageBox.Show("Process Successful!!!"); } } }
private void button1_Click(object sender, EventArgs e) { try { string name = Businessbp.executedb.owner + "run_func"; //run_func(out_vresult out number, out_vresult1 out number) string[] InParaName = new string[0] { }; string[] OutParaName = new string[2] { "out_vresult", "out_vresult1" }; OleDbType[] InParaType = new OleDbType[0] { }; OleDbType[] OutParaType = new OleDbType[2] { OleDbType.Numeric, OleDbType.Numeric }; string[] InParaValues = new string[0] { }; string[] OutParaValues = new string[2]; for (int i = 0; i < 2; i++) OutParaValues[i] = ""; int[] OutParaSize = new int[2] { 0, 0 }; string err = ""; Businessbp.executedb.ExecuteProcELECTRA(name, InParaName, InParaType, InParaValues, OutParaName, OutParaType, OutParaSize, ref OutParaValues, ref err); if (err != "") MessageBox.Show(err); else { int out_vresult = Int32.Parse(OutParaValues[0].ToString()); int out_vresult1 = Int32.Parse(OutParaValues[1].ToString()); if (out_vresult != 0) { MessageBox.Show("Error when process ELT_BALANCE_REFRESH_F"); return; } else { if (out_vresult1 != 0) { MessageBox.Show("Error when process ins_in_daily_balance"); return; } else { MessageBox.Show("Process successful...."); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
[ EditorBrowsableAttribute(EditorBrowsableState.Advanced) ] // MDAC 69508 public OleDbParameter(string parameterName, OleDbType dbType, int size, ParameterDirection direction, Byte precision, Byte scale, string sourceColumn, DataRowVersion sourceVersion, bool sourceColumnNullMapping, object value) : this() { // V2.0 everything - round trip all browsable properties + precision/scale ParameterName = parameterName; OleDbType = dbType; Size = size; Direction = direction; PrecisionInternal = precision; ScaleInternal = scale; SourceColumn = sourceColumn; SourceVersion = sourceVersion; SourceColumnNullMapping = sourceColumnNullMapping; Value = value; }
protected override bool GetNativeType(OleDbType oledbType, int providerTypeInt, string dataType, int length, int numericPrecision, int numericScale, bool isLong, out string dbTypeName, out string dbTypeNameComplete) { bool rval = base.GetNativeType(oledbType, providerTypeInt, dataType, length, numericPrecision, numericScale, isLong, out dbTypeName, out dbTypeNameComplete); if (!rval) { if ((oledbType == OleDbType.VarChar) || (oledbType == OleDbType.VarWChar) || (oledbType == OleDbType.Char) || (oledbType == OleDbType.WChar) || (oledbType == OleDbType.VarWChar) || (oledbType == OleDbType.VarWChar) || (oledbType == OleDbType.BSTR)) { dbTypeName = "Text"; dbTypeNameComplete = dbTypeName + "(" + length + ")"; } else if ((oledbType == OleDbType.LongVarChar) || (oledbType == OleDbType.LongVarWChar)) { dbTypeName = "Memo"; dbTypeNameComplete = dbTypeName; } else if (oledbType == OleDbType.LongVarBinary) { dbTypeName = "LongBinary"; dbTypeNameComplete = dbTypeName; } else { dbTypeName = "Variant"; dbTypeNameComplete = dbTypeName; } rval = true; foreach (IProviderType ptypeLoop in dbRoot.ProviderTypes) { if (ptypeLoop.LocalType.Equals(dbTypeName, StringComparison.CurrentCultureIgnoreCase)) { dataTypeTables[providerTypeInt] = ptypeLoop; break; } } } return rval; }
[ EditorBrowsableAttribute(EditorBrowsableState.Advanced) ] // MDAC 69508 public OleDbParameter(string parameterName, OleDbType dbType, int size, ParameterDirection direction, Boolean isNullable, Byte precision, Byte scale, string srcColumn, DataRowVersion srcVersion, object value) : this() { // V1.0 everything ParameterName = parameterName; OleDbType = dbType; Size = size; Direction = direction; IsNullable = isNullable; PrecisionInternal = precision; ScaleInternal = scale; SourceColumn = srcColumn; SourceVersion = srcVersion; Value = value; }
public void appendCriteria(string parameterName, string value, string criteria, ref string where, ref List <OleDbParameter> parameters, OleDbType dbType) { if (string.IsNullOrEmpty(value)) { return; } string cond = string.Format(criteria, "@" + parameterName); where += " AND " + cond; var p = new OleDbParameter(parameterName, dbType); p.Value = value; parameters.Add(p); }
public IDataReader OpenDataReader(String sql, ICollection conditionParams) { OleDbCommand cmd = (OleDbCommand)CreateCommand(); cmd.CommandText = sql; if (conditionParams != null) { IEnumerator iter = conditionParams.GetEnumerator(); while (iter.MoveNext()) { OleDbType type = GetOleDbType(iter.Current.GetType()); OleDbParameter param = cmd.Parameters.Add("p" + cmd.Parameters.Count, type); param.Value = iter.Current; } } return(cmd.ExecuteReader()); }
public override string GetNativeDbTypeName(IDataParameter para) { OleDbType type = ((OleDbParameter)para).OleDbType; if (type == OleDbType.VarWChar) { type = OleDbType.VarChar; } else if (type == OleDbType.DBDate) { type = OleDbType.Date; } else if (type == OleDbType.DBTimeStamp) //2014.5.14 增加,感谢网友 广州-晓伟 发现此问题 { type = OleDbType.Date; } return(type.ToString()); }
protected OleDbParameter CreateParameter( String parameterName, OleDbType dataType, Object value, Int32 size, ParameterDirection direction) { try { return(new OleDbParameter( parameterName, dataType, size, direction, false, 0, 0, "", System.Data.DataRowVersion.Current, value)); } catch { throw; } }
public OleDbParameter MakeParam(string ParamName, OleDbType dbType, int Size, ParameterDirection Direction, object Value) { OleDbParameter param; if (Size > 0) { param = new OleDbParameter(ParamName, dbType, Size); } else { param = new OleDbParameter(ParamName, dbType); } param.Direction = Direction; if ((Direction != ParameterDirection.Output) || (Value != null)) { param.Value = Value; } return(param); }
/// <summary> /// Return the oledbtype that the two parameters have in common /// </summary> /// <param name="one">OleDB type one</param> /// <param name="two">OleDB type one</param> /// <returns>Common OleDB type</returns> public static OleDbType CommonType(OleDbType one, OleDbType two) { // Trivial case: If both are equal if (one == two) { return(one); } if (one == OleDbType.Error) { return(two); } if (two == OleDbType.Error) { return(one); } // Find ancestors of one and two List <OleDbType> oneAncestors = FindAncestors(one, Hierarchy.Root); List <OleDbType> twoAncestors = FindAncestors(two, Hierarchy.Root); // Reverse since the function returns the a list of ancestors radiating from the parameter oneAncestors.Reverse(); twoAncestors.Reverse(); // Walk down the list and return if the pair does not match // E.g. // string = string (true) // decimal = decimal (true) // integer = double (false) => return decimal int i = 0; for (; i < Math.Min(oneAncestors.Count, twoAncestors.Count); i++) { if (oneAncestors[i] != twoAncestors[i]) { return(oneAncestors[i - 1]); } } return(oneAncestors[i - 1]); }
private void WriteGetAllProc(DataRow[] pRows) { _ColsStream.WriteLine(" [System.ComponentModel.DataObjectMethod(System.ComponentModel.DataObjectMethodType.Select, true)]"); _ColsStream.WriteLine(" public List<" + ddlTables.SelectedValue + "> GetAll(string SortBy)"); _ColsStream.WriteLine(" {"); _ColsStream.WriteLine(" List<" + ddlTables.SelectedValue + "> _DataItems = new List<" + ddlTables.SelectedValue + ">();"); _ColsStream.WriteLine(" TrackerDb _TDB = new TrackerDb();"); _ColsStream.WriteLine(" string _sqlCmd = CONST_SQL_SELECT;"); _ColsStream.WriteLine(" if (!String.IsNullOrEmpty(SortBy)) _sqlCmd += \" ORDER BY \" + SortBy; // Add order by string"); _ColsStream.WriteLine(" // params would go here if need"); _ColsStream.WriteLine(" IDataReader _DataReader = _TDB.ExecuteSQLGetDataReader(_sqlCmd);"); _ColsStream.WriteLine(" if (_DataReader != null)"); _ColsStream.WriteLine(" {"); _ColsStream.WriteLine(" while (_DataReader.Read())"); _ColsStream.WriteLine(" {"); _ColsStream.WriteLine(" " + ddlTables.SelectedValue + " _DataItem = new " + ddlTables.SelectedValue + "();"); _ColsStream.WriteLine(); _ColsStream.WriteLine(" #region StoreThisDataItem"); // for each item assign the value foreach (DataRow _row in pRows) { OleDbType _thisType = GetOleDBType(_row["DATA_TYPE"].ToString()); _ColsStream.Write(" _DataItem." + _row["COLUMN_NAME"].ToString() + " = (_DataReader[\"" + _row["COLUMN_NAME"].ToString() + "\""); _ColsStream.Write("] == DBNull.Value) ? " + _ColDBTypes[_thisType].typeNil + " : "); if (String.IsNullOrEmpty(_ColDBTypes[_thisType].typeConvert)) { _ColsStream.WriteLine("_DataReader[\"" + _row["COLUMN_NAME"].ToString() + "\"].ToString();"); } else { _ColsStream.WriteLine(_ColDBTypes[_thisType].typeConvert + "(_DataReader[\"" + _row["COLUMN_NAME"].ToString() + "\"]);"); } } _ColsStream.WriteLine(" #endregion"); _ColsStream.WriteLine(" _DataItems.Add(_DataItem);"); //// ---- change Items _DataItems _ColsStream.WriteLine(" }"); _ColsStream.WriteLine(" _DataReader.Close();"); _ColsStream.WriteLine(" }"); _ColsStream.WriteLine(" _TDB.Close();"); _ColsStream.WriteLine(" return _DataItems;"); _ColsStream.WriteLine(" }"); }
/// <summary> /// 创建存储过程参数 /// </summary> /// <param name="ParamName">参数名</param> /// <param name="DbType">参数类型</param> /// <param name="Size">参数大小</param> /// <param name="Direction">参数的方向(输入/输出)</param> /// <param name="Value">参数值</param> /// <returns>新参数对象</returns> public OleDbParameter MakeParam(string ParamName, OleDbType DbType, Int32 Size, ParameterDirection Direction, object Value) { OleDbParameter param; if (Size > 0) { param = new OleDbParameter(ParamName, DbType, Size); } else { param = new OleDbParameter(ParamName, DbType); } param.Direction = Direction; if (!(Direction == ParameterDirection.Output && Value == null)) { param.Value = Value; } return(param); }
static public ColumnType DatabaseToNetTypeConverter(object dbValue) { ColumnType result = ColumnType.Text; try { OleDbType columnType = (OleDbType)Convert.ToInt32(dbValue); result = Helper.NetTypeConverter(Helper.OleDbToNetTypeConverter(columnType)); if (columnType == OleDbType.WChar || columnType == OleDbType.VarWChar || columnType == OleDbType.LongVarWChar) { result = ColumnType.UnicodeText; } } catch (Exception ex) { Console.WriteLine(ex.Message); } return(result); }
public static TOM.DataType ToTOMDataType(OleDbType AMODataType) { try { switch (AMODataType) { case OleDbType.WChar: return(TOM.DataType.String); case OleDbType.Binary: return(TOM.DataType.Binary); case OleDbType.Boolean: return(TOM.DataType.Boolean); case OleDbType.Date: return(TOM.DataType.DateTime); case OleDbType.Decimal: return(TOM.DataType.Decimal); case OleDbType.Double: return(TOM.DataType.Double); case OleDbType.BigInt: return(TOM.DataType.Int64); case OleDbType.Variant: return(TOM.DataType.Variant); case OleDbType.Empty: return(TOM.DataType.Unknown); default: throw new Exception("The following type is unhandled: " + AMODataType.ToString()); } } catch (Exception e) { throw new Exception("Error mapping AMO DataType: " + e.Message); } }
private void func_PastFirstCP(string card_number, string user_id) { try { const int count_input_val = 2; const int count_outut_val = 2; string name = Businessbp.executedb.owner + "Proc_NAB_PastFirstPC"; //Proc_NAB_PastFirstPC(I_card_number in varchar2,u_modify in varchar2, RESULT_OUT out number,Emsg_out out varchar2) string[] InParaName = new string[count_input_val] { "I_card_number", "u_modify" }; string[] OutParaName = new string[count_outut_val] { "RESULT_OUT", "Emsg_out" }; OleDbType[] InParaType = new OleDbType[count_input_val] { OleDbType.VarChar, OleDbType.VarChar }; OleDbType[] OutParaType = new OleDbType[count_outut_val] { OleDbType.Numeric, OleDbType.VarChar }; string[] InParaValues = new string[count_input_val] { card_number,user_id}; string[] OutParaValues = new string[count_outut_val]; for (int i = 0; i < count_outut_val; i++) OutParaValues[i] = ""; int[] OutParaSize = new int[count_outut_val] { 0, 200 }; string err = ""; Businessbp.executedb.ExecuteProcELECTRA(name, InParaName, InParaType, InParaValues, OutParaName, OutParaType, OutParaSize, ref OutParaValues, ref err); if (err != "") MessageBox.Show(err); else { int RESULT_OUT = Int32.Parse(OutParaValues[0].ToString()); string Emsg_out = OutParaValues[1].ToString(); if (RESULT_OUT != 1) // khác 1: báo lỗi { MessageBox.Show("Error:\n" + Emsg_out); return; } else // =1:OK { MessageBox.Show("Process successful...."); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
protected AccessDataProvider(string name, MappingSchema mappingSchema) : base(name, mappingSchema) { SqlProviderFlags.AcceptsTakeAsParameter = false; SqlProviderFlags.IsSkipSupported = false; SqlProviderFlags.IsCountSubQuerySupported = false; SqlProviderFlags.IsInsertOrUpdateSupported = false; SetCharField("DBTYPE_WCHAR", (r, i) => r.GetString(i).TrimEnd()); SetProviderField <IDataReader, TimeSpan, DateTime>((r, i) => r.GetDateTime(i) - new DateTime(1899, 12, 30)); SetProviderField <IDataReader, DateTime, DateTime>((r, i) => GetDateTime(r, i)); _sqlOptimizer = new AccessSqlOptimizer(SqlProviderFlags); if (System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator != ".") { _decimalType = OleDbType.VarChar; } }
private object GetDefaultValueFromString(string defaultValueString, OleDbType dataType) { object result = null; if ((dataType == OleDbType.VarChar) || (dataType == OleDbType.LongVarChar) || (dataType == OleDbType.VarWChar) || (dataType == OleDbType.LongVarWChar) || (dataType == OleDbType.Char) || (dataType == OleDbType.WChar)) { result = defaultValueString; } else { result = GetParseFunction(dataType)?.Invoke(defaultValueString); } return(result); }
private void Active(string card_number, string delivery_flag) { const int para = 2; if (card_number != "" && delivery_flag == "0") { // Cardnbr in varchar2, //go_status in number, //usermodify in varchar2, //Result_out out number, //Emsg_out out varchar2) is int i = 0; string name = "" + Businessbp.executedb.owner + "KICH_HOAT_THE"; string[] InParaName = new string[3] { "cardnbr", "go_status", "usermodify" }; string[] OutParaName = new string[para] { "Result_out", "Emsg_out" }; OleDbType[] InParaType = new OleDbType[3] { OleDbType.VarChar, OleDbType.VarChar, OleDbType.VarChar }; OleDbType[] OutParaType = new OleDbType[para] { OleDbType.Numeric, OleDbType.VarChar }; string[] InParaValues = new string[3] { card_number, "1", Businessbp.executedb.Usrid }; string[] OutParaValues = new string[para]; for (i = 0; i < para; i++) OutParaValues[i] = ""; int[] OutParaSize = new int[para] { 0, 200 }; string err = ""; Businessbp.executedb.ExecuteProc(name, InParaName, InParaType, InParaValues, OutParaName, OutParaType, OutParaSize, ref OutParaValues, ref err); if (err != "") { MessageBox.Show("Err Load_Data: " + err); } else { if (OutParaValues[1].ToString() == "-1") { MessageBox.Show("Err Load_Data: " + OutParaValues[1].ToString()); } else { } } } }
private void SetProperties(MeasureDataType dataType, Type type, double min, double max, bool allowsDecimals, bool allowsMoreThan4Decimals) { this.dataType = dataType; this.type = type; if (dataType == MeasureDataType.Currency) //Type=Decimal isn't enough for it to correctly determine Currency { this.oleDbType = OleDbType.Currency; } else { this.oleDbType = OleDbTypeConverter.GetRestrictedOleDbType(type); } this.min = min; this.max = max; this.displayMin = FormatDouble(min); this.displayMax = FormatDouble(max); this.allowsDecimals = allowsDecimals; this.allowsMoreThan4Decimals = allowsMoreThan4Decimals; }
protected override bool IndexAllowed(string strNomTable, string[] strChamps) { DataTable schema = GetOleDbSchemaColonnes(); DataView view = new DataView(schema); foreach (string strChamp in strChamps) { view.RowFilter = "TABLE_NAME='" + strNomTable + "' and COLUMN_NAME='" + strChamp + "'"; if (view.Count > 0) { int nType = (int)view[0]["DATA_TYPE"]; OleDbType tp = (OleDbType)nType; if (tp == OleDbType.LongVarChar || tp == OleDbType.LongVarWChar || tp == OleDbType.WChar) { return(false); } } } return(true); }
public static bool CanDistinctCount(OleDbType type) { switch (type) { case OleDbType.BigInt: case OleDbType.Currency: case OleDbType.Double: case OleDbType.Integer: case OleDbType.Single: case OleDbType.SmallInt: case OleDbType.TinyInt: case OleDbType.UnsignedBigInt: case OleDbType.UnsignedInt: case OleDbType.UnsignedSmallInt: case OleDbType.UnsignedTinyInt: return(true); default: return(false); } }
/// <summary> /// /// </summary> /// <param name="ParamName"></param> /// <param name="DbType"></param> /// <param name="Size"></param> /// <param name="Direction"></param> /// <param name="Value"></param> /// <returns></returns> private OleDbParameter MakeParam(string ParamName, OleDbType DbType, Int32 Size, ParameterDirection Direction, object Value) { OleDbParameter Para; if (Size > 0) { Para = new OleDbParameter(ParamName, DbType, Size); } else { Para = new OleDbParameter(ParamName, DbType); } Para.Direction = Direction; if (!(Para.Direction == ParameterDirection.Output && Value == null)) { Para.Value = Value; } return(Para); }
private void bt_process_Click(object sender, EventArgs e) { try { string name = Businessbp.executedb.owner + "nab_process_query.Proc_updateMer_discount"; //run_func(out_vresult out number, out_vresult1 out number) string[] InParaName = new string[0] { }; string[] OutParaName = new string[2] { "Result_out", "Emsg_out" }; OleDbType[] InParaType = new OleDbType[0] { }; OleDbType[] OutParaType = new OleDbType[2] { OleDbType.Numeric, OleDbType.VarChar }; string[] InParaValues = new string[0] { }; string[] OutParaValues = new string[2]; int[] OutParaSize = new int[2] { 0, 100 }; string err = ""; Businessbp.executedb.ExecuteProcELECTRA(name, InParaName, InParaType, InParaValues, OutParaName, OutParaType, OutParaSize, ref OutParaValues, ref err); if (err != "") MessageBox.Show(err); else { int Result_out = Int32.Parse(OutParaValues[0].ToString()); string Emsg_out = OutParaValues[1].ToString(); if (Result_out != 1) { MessageBox.Show("Error!!!" + Emsg_out); } else { MessageBox.Show("Process Successful!!!"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
internal static int GetDbTypeSize(OleDbType oleDbType) { switch (oleDbType) { case OleDbType.Boolean: return 1; case OleDbType.SmallInt: return 2; case OleDbType.Integer: return 4; case OleDbType.BigInt: return 8; case OleDbType.Decimal: return 16; case OleDbType.VarChar: case OleDbType.Char: case OleDbType.Binary: return 2048; default: return 0; } }
public Tuple <string, string> return_type(OleDbType Type, string clength, string nprecision, string nscale) { string columnType = ""; string valueType = ""; switch (Type) { case OleDbType.Date: columnType = "DATETIME"; break; case OleDbType.DBDate: columnType = "DATETIME"; break; case OleDbType.Decimal: columnType = "DECIMAL"; valueType = string.IsNullOrEmpty(clength) ? "(" + nprecision + "," + nscale + ")" : "(" + clength + ")"; break; case OleDbType.Double: columnType = "NUMERIC"; valueType = string.IsNullOrEmpty(clength) ? "(" + nprecision + "," + nscale + ")" : "(" + clength + ")"; break; case OleDbType.Numeric: columnType = "NUMERIC"; valueType = string.IsNullOrEmpty(clength) ? "(" + nprecision + "," + nscale + ")" : "(" + clength + ")"; break; case OleDbType.VarChar: columnType = "VARCHAR"; valueType = string.IsNullOrEmpty(clength) ? "(" + nprecision + "," + nscale + ")" : "(" + clength + ")"; break; case OleDbType.Char: columnType = "CHAR"; valueType = string.IsNullOrEmpty(clength) ? "(" + nprecision + "," + nscale + ")" : "(" + clength + ")"; break; } return(new Tuple <string, string>(columnType, valueType)); }
private static JFieldType GetJValueType(OleDbType dbType) { switch (dbType) { //case SqlDbType.BigInt: return JValueType.Numeric; //case SqlDbType.Binary: return JValueType.String; //case SqlDbType.Bit: return JValueType.String; //case SqlDbType.Char: return JValueType.String; //case SqlDbType.DateTime: return JValueType.DateTime; //case SqlDbType.Decimal: return JValueType.Numeric; //case SqlDbType.Float: return JValueType.Numeric; //case SqlDbType.Image: return JValueType.String; //case SqlDbType.Int: return JValueType.Numeric; //case SqlDbType.Money: return JValueType.Numeric; //case SqlDbType.NChar: return JValueType.String; //case SqlDbType.NText: return JValueType.String; //case SqlDbType.NVarChar: return JValueType.String; //case SqlDbType.Real: return JValueType.String; //case SqlDbType.UniqueIdentifier: return JValueType.String; //case SqlDbType.SmallDateTime: return JValueType.DateTime; //case SqlDbType.SmallInt: return JValueType.Numeric; //case SqlDbType.SmallMoney: return JValueType.Numeric; //case SqlDbType.Text: return JValueType.String; //case SqlDbType.Timestamp: return JValueType.DateTime; //case SqlDbType.TinyInt: return JValueType.Numeric; //case SqlDbType.VarBinary: return JValueType.String; //case SqlDbType.VarChar: return JValueType.String; //case SqlDbType.Variant: return JValueType.String; //case SqlDbType.Xml: return JValueType.String; //case SqlDbType.Udt: return JValueType.String; //case SqlDbType.Structured: return JValueType.String; //case SqlDbType.Date: return JValueType.DateTime; //case SqlDbType.Time: return JValueType.DateTime; //case SqlDbType.DateTime2: return JValueType.DateTime; //case SqlDbType.DateTimeOffset: return JValueType.DateTime; } throw new NotSupportedException(); }
/// <summary> /// 字段类型名称 /// </summary> /// <param name="AccType"></param> /// <returns></returns> protected virtual string FieldTypeName(OleDbType AccType) { switch (AccType) { case OleDbType.VarWChar: return("VarWChar"); case OleDbType.VarChar: return("VarChar"); case OleDbType.WChar: return("WChar"); case OleDbType.LongVarChar: return("LongVarChar"); case OleDbType.LongVarWChar: return("LongVarWChar"); default: return("VarWChar"); } }
/// <summary> /// Este método preenche os dados das colunas da table. /// </summary> private void GetColumnData(TableMap map) { DataTable dt = GetColumns(map.TableName); foreach (DataRow row in dt.Rows) { string columnName = (string)row["COLUMN_NAME"]; FieldMap fm = map.GetFieldMapFromColumn(columnName); if (fm == null) { fm = new FieldMap(map, columnName); map.Fields.Add(fm); } fm.IsNullable = Convert.ToBoolean(row["IS_NULLABLE"]); OleDbType dbType = (OleDbType)row["DATA_TYPE"]; fm.SetDbType((long)dbType); fm.DbTypeName = dbType.ToString(); if (dbType == OleDbType.Decimal || dbType == OleDbType.Numeric || dbType == OleDbType.VarNumeric) { fm.Size = Convert.ToInt32(row["NUMERIC_PRECISION"]); } else if (dbType == OleDbType.LongVarBinary || dbType == OleDbType.LongVarChar || dbType == OleDbType.LongVarWChar || dbType == OleDbType.VarBinary || dbType == OleDbType.VarChar || dbType == OleDbType.VarWChar || dbType == OleDbType.WChar || dbType == OleDbType.Char || dbType == OleDbType.BSTR || dbType == OleDbType.Binary) { fm.Size = Convert.ToInt32(row["CHARACTER_MAXIMUM_LENGTH"]); } int columnFlags = Convert.ToInt32(row["COLUMN_FLAGS"]); int flags = (int)DBCOLUMNFLAGS.ISNULLABLE + (int)DBCOLUMNFLAGS.MAYBENULL; bool isNullableFlag = (columnFlags & flags) != 0; flags = (int)DBCOLUMNFLAGS.WRITE + (int)DBCOLUMNFLAGS.WRITEUNKNOWN; bool isReadOnly = (columnFlags & flags) == 0; fm.IsReadOnly = isReadOnly; if (row["DESCRIPTION"] != DBNull.Value && row["DESCRIPTION"] is string) { fm.Comment = row["DESCRIPTION"].ToString(); } } }
public static string GetSystemTypeFromOleDBTypeID(OleDbType oleDbTypeID) { string rootDataType = null; systemTypeToOleDbType.OleDbType = oleDbTypeID; switch (systemTypeToOleDbType.OleDbType) { case OleDbType.Binary: case OleDbType.VarBinary: return(typeof(System.Byte[]).ToString()); case OleDbType.DBDate: return(typeof(System.DateTime).ToString()); case OleDbType.DBTime: return(typeof(System.TimeSpan).ToString()); case OleDbType.Currency: return(typeof(System.Double).ToString()); case OleDbType.TinyInt: return(typeof(System.Int16).ToString()); } // else assume DbType-Name is identical to System-TypeName rootDataType = "System." + systemTypeToOleDbType.DbType.ToString(); /// System.String if ((rootDataType == null) || (null == Type.GetType(rootDataType, false, true)) || // does not exist (rootDataType.ToLower().IndexOf("string") >= 0)) // AnsiString, AnsiStringFixedLength, StringFixedLength { rootDataType = MAPPING_DEFAULT_SYSTEM_TYPE; } return(rootDataType); }
public virtual OleDbType GetVariableType(Variable variable) { OleDbType retType = OleDbType.Empty; switch (variable.Type.ToUpper(System.Globalization.CultureInfo.InvariantCulture)) { case "STRING": retType = OleDbType.WChar; break; case "INT32": retType = OleDbType.Integer; break; case "INT64": retType = OleDbType.BigInt; break; case "BOOLEAN": retType = OleDbType.Boolean; break; case "Byte": retType = OleDbType.Binary; break; case "Char": retType = OleDbType.Char; break; case "DateTime": retType = OleDbType.DBTimeStamp; break; case "DBNull": retType = OleDbType.Empty; break; case "Double": retType = OleDbType.Double; break; case "Int16": retType = OleDbType.SmallInt; break; case "SByte": retType = OleDbType.Binary; break; case "Single": retType = OleDbType.Single; break; case "UInt32": retType = OleDbType.UnsignedInt; break; case "UInt64": retType = OleDbType.UnsignedBigInt; break; } return(retType); }
protected OleDbParameter CreateParameter( String parameterName, OleDbType dataType, Object value) { try { return(new OleDbParameter( parameterName, dataType, 0, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Current, value)); } catch { throw; } }
public DataTable FillDataTable(DataTable dt, String sql, ICollection conditionParams) { using (OleDbCommand cmd = (OleDbCommand)CreateCommand()) { cmd.CommandText = sql; if (conditionParams != null) { foreach (object p in conditionParams) { OleDbType type = ((p == null) ? OleDbType.VarChar : GetOleDbType(p.GetType())); OleDbParameter param = cmd.Parameters.Add("p" + cmd.Parameters.Count, type); param.Value = p; } } using (OleDbDataAdapter da = new OleDbDataAdapter()) { da.SelectCommand = cmd; dt.BeginLoadData(); da.Fill(dt); dt.EndLoadData(); return(dt); } } }
// Definir los tipos de datos en C# y su equivalencia en tipo OleDbType private static OleDbType ConvertirTipo(object obj) { if (obj == null || obj.ToString().Length == 0) { return(OleDbType.Variant); } var map = new Dictionary <Func <object, bool>, OleDbType>() { { d => d.GetType() == typeof(Int16), OleDbType.Binary }, { d => d.GetType() == typeof(Int32), OleDbType.Integer }, { d => d.GetType() == typeof(Int64), OleDbType.BigInt }, { d => d.GetType() == typeof(Double), OleDbType.Double }, { d => d.GetType() == typeof(DateTime), OleDbType.DBDate }, { d => d.GetType() == typeof(Decimal), OleDbType.Decimal }, { d => d.GetType() == typeof(String), OleDbType.VarChar }, { d => d.GetType() == typeof(Boolean), OleDbType.Boolean }, }; var key = map.Keys.Single(test => test(obj)); OleDbType value = map[key]; return(value); }
public override DbParameter AddParameter(string parameterName, object value) { OleDbType dbType = OleDbType.WChar; if (value is Int32) { dbType = OleDbType.Integer; } else if (value is DateTime) { dbType = OleDbType.Date; } else if (value is Double) { dbType = OleDbType.Double; } else if (value is Decimal) { dbType = OleDbType.Decimal; } else if (value is Boolean) { dbType = OleDbType.Boolean; } else if (value is string && ((string)value).Length > 4000) { dbType = OleDbType.BSTR; } OleDbParameter param = new OleDbParameter(parameterName, dbType); param.Value = value; param.Direction = ParameterDirection.Input; DbCommand.Parameters.Add(param); return(param); }
private static CodeExpression BuildNewOleDbParameterStatement(DesignParameter parameter) { OleDbParameter parameter2 = new OleDbParameter(); OleDbType oleDbType = OleDbType.Char; bool flag = false; if ((parameter.ProviderType != null) && (parameter.ProviderType.Length > 0)) { try { oleDbType = (OleDbType)Enum.Parse(typeof(OleDbType), parameter.ProviderType); flag = true; } catch { } } if (!flag) { parameter2.DbType = parameter.DbType; oleDbType = parameter2.OleDbType; } return(NewParameter(parameter, typeof(OleDbParameter), typeof(OleDbType), oleDbType.ToString())); }
/// <summary> /// 为一个 DbCommand 实例添加一个值为DBNull.Value的输出参数。 /// </summary> /// <param name="command">表示要对数据源执行的 SQL 语句或存储过程。</param> /// <param name="name">参数名。</param> /// <param name="oleDbType">数据类型。</param> /// <param name="size">长度。</param> public void AddOutParameter(DbCommand command, string name, OleDbType oleDbType, int size) { AddParameter(command, name, oleDbType, size, ParameterDirection.Output, true, String.Empty, DataRowVersion.Default, DBNull.Value); }
/// <summary> /// 为一个 DbCommand 实例添加一个输入参数。 /// </summary> /// <param name="command">表示要对数据源执行的 SQL 语句或存储过程。</param> /// <param name="name">参数名。</param> /// <param name="oleDbType">数据类型。</param> /// <param name="sourceColumn">源列的名称。</param> /// <param name="sourceVersion">数据行的版本号。</param> /// <param name="value">参数值。</param> public void AddInParameter(DbCommand command, string name, OleDbType oleDbType, string sourceColumn, DataRowVersion sourceVersion, object value) { AddParameter(command, name, oleDbType, 0, ParameterDirection.Input, true, sourceColumn, sourceVersion, value); }
/// <summary> /// 为一个 DbCommand 实例添加一个输入参数。 /// </summary> /// <param name="command">表示要对数据源执行的 SQL 语句或存储过程。</param> /// <param name="name">参数名。</param> /// <param name="oleDbType">数据类型。</param> /// <param name="value">参数值。</param> public void AddInParameter(DbCommand command, string name, OleDbType oleDbType, object value) { AddParameter(command, name, oleDbType, ParameterDirection.Input, String.Empty, DataRowVersion.Default, value); }