public override DbCommand CreateCommand() { var db = new SqlServerDatabase(""); var cm = db.CreateCommand(); cm.CommandType = CommandType.StoredProcedure; cm.CommandText = this.GetStoredProcedureName(); DbParameter p = null; p = db.CreateParameter("@PK_PrimaryKeyColumn", SqlDbType.BigInt, 19, 0); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.Input; p.Value = this.PK_PrimaryKeyColumn; cm.Parameters.Add(p); p = db.CreateParameter("@PK_TimestampColumn", SqlDbType.Timestamp, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.Input; p.Value = this.PK_TimestampColumn; cm.Parameters.Add(p); for (int i = 0; i < cm.Parameters.Count; i++) { if (cm.Parameters[i].Value == null) { cm.Parameters[i].Value = DBNull.Value; } } return(cm); }
public override DbCommand CreateCommand() { var db = new SqlServerDatabase(""); var cm = db.CreateCommand(); cm.CommandType = CommandType.StoredProcedure; cm.CommandText = this.GetStoredProcedureName(); DbParameter p = null; p = db.CreateParameter("@IntColumn", SqlDbType.Int, 10, 0); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Value = this.IntColumn; cm.Parameters.Add(p); p = db.CreateParameter("@NVarCharColumn", SqlDbType.NVarChar, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.Input; p.Size = 100; p.Value = this.NVarCharColumn; cm.Parameters.Add(p); for (int i = 0; i < cm.Parameters.Count; i++) { if (cm.Parameters[i].Value == null) { cm.Parameters[i].Value = DBNull.Value; } } return(cm); }
public override DbCommand CreateCommand() { var db = new SqlServerDatabase(""); var cm = db.CreateCommand(); cm.CommandType = CommandType.StoredProcedure; cm.CommandText = this.GetStoredProcedureName(); DbParameter p = null; p = db.CreateParameter("@BigIntColumn", SqlDbType.BigInt, 19, 0); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Value = this.BigIntColumn; cm.Parameters.Add(p); p = db.CreateParameter("@StructuredColumn", SqlDbType.Structured, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.Input; p.SetTypeName("MyTableType"); var dt = this.StructuredColumn.CreateDataTable(); foreach (var item in this.StructuredColumn.Records) { dt.Rows.Add(item.GetValues()); } p.Value = dt; cm.Parameters.Add(p); for (int i = 0; i < cm.Parameters.Count; i++) { if (cm.Parameters[i].Value == null) { cm.Parameters[i].Value = DBNull.Value; } } return(cm); }
public override DbCommand CreateCommand() { var db = new SqlServerDatabase(""); var cm = db.CreateCommand(); cm.CommandType = CommandType.StoredProcedure; cm.CommandText = this.GetStoredProcedureName(); DbParameter p = null; p = db.CreateParameter("@BigIntColumn", SqlDbType.BigInt, 19, 0); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Value = this.BigIntColumn; cm.Parameters.Add(p); p = db.CreateParameter("@BinaryColumn", SqlDbType.Binary, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Size = 100; p.Value = this.BinaryColumn; cm.Parameters.Add(p); p = db.CreateParameter("@ImageColumn", SqlDbType.Image, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.Input; p.Size = 2147483647; p.Value = this.ImageColumn; cm.Parameters.Add(p); p = db.CreateParameter("@VarBinaryColumn", SqlDbType.VarBinary, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Size = 100; p.Value = this.VarBinaryColumn; cm.Parameters.Add(p); p = db.CreateParameter("@BitColumn", SqlDbType.Bit, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Value = this.BitColumn; cm.Parameters.Add(p); p = db.CreateParameter("@CharColumn", SqlDbType.Char, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Size = 100; p.Value = this.CharColumn; cm.Parameters.Add(p); p = db.CreateParameter("@NCharColumn", SqlDbType.NChar, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Size = 100; p.Value = this.NCharColumn; cm.Parameters.Add(p); p = db.CreateParameter("@NTextColumn", SqlDbType.NText, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.Input; p.Size = 1073741823; p.Value = this.NTextColumn; cm.Parameters.Add(p); p = db.CreateParameter("@NVarCharColumn", SqlDbType.NVarChar, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Size = 100; p.Value = this.NVarCharColumn; cm.Parameters.Add(p); p = db.CreateParameter("@TextColumn", SqlDbType.Text, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.Input; p.Size = 2147483647; p.Value = this.TextColumn; cm.Parameters.Add(p); p = db.CreateParameter("@VarCharColumn", SqlDbType.VarChar, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Size = 100; p.Value = this.VarCharColumn; cm.Parameters.Add(p); p = db.CreateParameter("@XmlColumn", SqlDbType.Xml, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Size = -1; p.Value = this.XmlColumn; cm.Parameters.Add(p); p = db.CreateParameter("@DateTimeColumn", SqlDbType.DateTime, null, 3); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Value = this.DateTimeColumn; cm.Parameters.Add(p); p = db.CreateParameter("@SmallDateTimeColumn", SqlDbType.SmallDateTime, null, 0); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Value = this.SmallDateTimeColumn; cm.Parameters.Add(p); p = db.CreateParameter("@DateColumn", SqlDbType.Date, null, 0); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Value = this.DateColumn; cm.Parameters.Add(p); p = db.CreateParameter("@TimeColumn", SqlDbType.Time, null, 7); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Value = this.TimeColumn; cm.Parameters.Add(p); p = db.CreateParameter("@DateTime2Column", SqlDbType.DateTime2, null, 7); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Value = this.DateTime2Column; cm.Parameters.Add(p); p = db.CreateParameter("@DecimalColumn", SqlDbType.Decimal, 18, 0); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Value = this.DecimalColumn; cm.Parameters.Add(p); p = db.CreateParameter("@MoneyColumn", SqlDbType.Money, 19, 4); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Value = this.MoneyColumn; cm.Parameters.Add(p); p = db.CreateParameter("@SmallMoneyColumn", SqlDbType.SmallMoney, 10, 4); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Value = this.SmallMoneyColumn; cm.Parameters.Add(p); p = db.CreateParameter("@FloatColumn", SqlDbType.Float, 53, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Value = this.FloatColumn; cm.Parameters.Add(p); p = db.CreateParameter("@IntColumn", SqlDbType.Int, 10, 0); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Value = this.IntColumn; cm.Parameters.Add(p); p = db.CreateParameter("@RealColumn", SqlDbType.Real, 24, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Value = this.RealColumn; cm.Parameters.Add(p); p = db.CreateParameter("@UniqueIdentifierColumn", SqlDbType.UniqueIdentifier, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Value = this.UniqueIdentifierColumn; cm.Parameters.Add(p); p = db.CreateParameter("@SmallIntColumn", SqlDbType.SmallInt, 5, 0); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Value = this.SmallIntColumn; cm.Parameters.Add(p); p = db.CreateParameter("@TinyIntColumn", SqlDbType.TinyInt, 3, 0); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Value = this.TinyIntColumn; cm.Parameters.Add(p); p = db.CreateParameter("@DateTimeOffsetColumn", SqlDbType.DateTimeOffset, null, 7); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Value = this.DateTimeOffsetColumn; cm.Parameters.Add(p); p = db.CreateParameter("@GeometryColumn", SqlDbType.Udt, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Size = -1; p.SetUdtTypeName("geometry"); p.Value = this.GeometryColumn; cm.Parameters.Add(p); p = db.CreateParameter("@GeographyColumn", SqlDbType.Udt, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Size = -1; p.SetUdtTypeName("geography"); p.Value = this.GeographyColumn; cm.Parameters.Add(p); p = db.CreateParameter("@HierarchyIDColumn", SqlDbType.Udt, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.Input; p.Size = 892; p.SetUdtTypeName("hierarchyid"); p.Value = this.HierarchyIDColumn; cm.Parameters.Add(p); p = db.CreateParameter("@EnumColumn", SqlDbType.NVarChar, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Size = 20; p.Value = this.EnumColumn; cm.Parameters.Add(p); for (int i = 0; i < cm.Parameters.Count; i++) { if (cm.Parameters[i].Value == null) { cm.Parameters[i].Value = DBNull.Value; } } return(cm); }
public override DbCommand CreateCommand() { var db = new SqlServerDatabase(""); var cm = db.CreateCommand(); cm.CommandType = CommandType.StoredProcedure; cm.CommandText = this.GetStoredProcedureName(); DbParameter p = null; p = db.CreateParameter("@BigIntColumn", SqlDbType.BigInt, 19, 0); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.Input; p.Value = this.BigIntColumn; cm.Parameters.Add(p); p = db.CreateParameter("@IntColumn", SqlDbType.Int, 10, 0); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.Input; p.Value = this.IntColumn; cm.Parameters.Add(p); p = db.CreateParameter("@FloatColumn", SqlDbType.Float, 53, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.Input; p.Value = this.FloatColumn; cm.Parameters.Add(p); p = db.CreateParameter("@BinaryColumn", SqlDbType.Binary, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.Input; p.Size = 100; p.Value = this.BinaryColumn; cm.Parameters.Add(p); p = db.CreateParameter("@TimestampColumn", SqlDbType.Timestamp, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.InputOutput; p.Value = this.TimestampColumn; cm.Parameters.Add(p); p = db.CreateParameter("@VarBinaryColumn", SqlDbType.VarBinary, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.Input; p.Size = 100; p.Value = this.VarBinaryColumn; cm.Parameters.Add(p); p = db.CreateParameter("@BitColumn", SqlDbType.Bit, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.Input; p.Value = this.BitColumn; cm.Parameters.Add(p); p = db.CreateParameter("@NCharColumn", SqlDbType.NChar, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.Input; p.Size = 100; p.Value = this.NCharColumn; cm.Parameters.Add(p); p = db.CreateParameter("@NTextColumn", SqlDbType.NText, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.Input; p.Size = 1073741823; p.Value = this.NTextColumn; cm.Parameters.Add(p); p = db.CreateParameter("@NVarCharColumn", SqlDbType.NVarChar, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.Input; p.Size = 100; p.Value = this.NVarCharColumn; cm.Parameters.Add(p); p = db.CreateParameter("@PK_BigIntColumn", SqlDbType.BigInt, 19, 0); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.Input; p.Value = this.PK_BigIntColumn; cm.Parameters.Add(p); p = db.CreateParameter("@PK_IntColumn", SqlDbType.Int, 10, 0); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.Input; p.Value = this.PK_IntColumn; cm.Parameters.Add(p); p = db.CreateParameter("@PK_FloatColumn", SqlDbType.Float, 53, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.Input; p.Value = this.PK_FloatColumn; cm.Parameters.Add(p); p = db.CreateParameter("@PK_TimestampColumn", SqlDbType.Timestamp, null, null); p.SourceColumn = p.ParameterName; p.Direction = ParameterDirection.Input; p.Value = this.PK_TimestampColumn; cm.Parameters.Add(p); for (int i = 0; i < cm.Parameters.Count; i++) { if (cm.Parameters[i].Value == null) { cm.Parameters[i].Value = DBNull.Value; } } return(cm); }