private void SendValue() { if (m_loadingData) { return; } if (dataGridView1.DataSource == null) { return; } if (m_data == null || m_data.LookupInfo == null) { return; } if (dataGridView1.SelectedRows.Count != 1) { return; } DataTable tbl = (DataTable)dataGridView1.DataSource; DataGridViewRow row = dataGridView1.SelectedRows[0]; object value = row.Cells[m_data.LookupInfo.PkColIndex].Value; BedValueHolder h1 = new BedValueHolder(), h2 = new BedValueHolder(); h1.ReadFrom(value); m_data.BedConvertor.ConvertValue(h1, m_targetType, h2); m_data.SetData(h2); }
public static bool GetValueAsXml(object value, ref string xtype, ref string xdata) { var holder = new BedValueHolder(); holder.ReadFrom(value); return(GetValueAsXml(holder, ref xtype, ref xdata)); }
private BedValueHolder WantValue() { if (!m_loadedValue) { m_workingHolder.ReadFrom(m_values[m_curReadField]); m_loadedValue = true; } return(m_workingHolder); }
public object ConvertValue(TypeStorage type, object value) { m_holder1.ReadFrom(value); var srctype = m_holder1.GetFieldType(); if (srctype == type || srctype == TypeStorage.Null) { return(value); } ConvertValue(m_holder1, type, m_holder2); return(m_holder2.BoxTypedValue()); }
// not very efective, better is to direct call DDA.GetSqlLiteral public static string GetSqlLiteral(this ISqlDialect dialect, object value) { var hld = new BedValueHolder(); var dda = dialect.CreateDataAdapter(); hld.ReadFrom(value); return(dda.GetSqlLiteral(hld)); //if (value == DBNull.Value || value == null) return "NULL"; //if (value.GetType().IsNumberType()) return dialect.EscapeNumber(value); //if (value is byte[]) return dialect.EscapeBinary((byte[])value); //if (value is DateTime) return dialect.EscapeDateTime((DateTime)value); //if (value is bool) return dialect.EscapeLogical((bool)value); //return dialect.QuoteString(Convert.ToString(value, CultureInfo.InvariantCulture)); }
public string GetSqlLiteral(object value, DbTypeBase type) { m_holder.ReadFrom(value); return(GetSqlLiteral(m_holder, type)); }