Beispiel #1
0
        public static void UpdateProcNull(string PK)
        {
            DbParameter[] parms = GetParameters();
            parms[0].Value  = PK;
            parms[1].Value  = DBNull.Value;
            parms[2].Value  = DBNull.Value;
            parms[3].Value  = DBNull.Value;
            parms[4].Value  = DBNull.Value;
            parms[5].Value  = DBNull.Value;
            parms[6].Value  = DBNull.Value;
            parms[7].Value  = DBNull.Value;
            parms[8].Value  = DBNull.Value;
            parms[9].Value  = DBNull.Value;
            parms[10].Value = DBNull.Value;
            parms[11].Value = DBNull.Value;
            DbCommand cmd = new DbProxyCommand();

            cmd.Parameters.AddRange(parms);
            using (DbConnection conn = new DbProxyConnection())
            {
                conn.ConnectionString = proxyConnString;
                conn.Open();
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = SqlUpdateTestDbProxy;
                cmd.ExecuteNonQuery();
                conn.Close();
            }
            cmd.Parameters.Clear();
            cmd.Dispose();
        }
Beispiel #2
0
        public static void UpdateProcNormal(string PK, long bigIntValue, int intValue, short smallIntValue, byte tinyIntValue, DateTime dateTimeValue, float realValue, double floatValue, string varcharText, string charText, byte[] varbinaryStream, byte[] binaryStream)
        {
            DbParameter[] parms = GetParameters();
            parms[0].Value  = PK;
            parms[1].Value  = bigIntValue;
            parms[2].Value  = intValue;
            parms[3].Value  = smallIntValue;
            parms[4].Value  = tinyIntValue;
            parms[5].Value  = dateTimeValue;
            parms[6].Value  = realValue;
            parms[7].Value  = floatValue;
            parms[8].Value  = varcharText;
            parms[9].Value  = charText;
            parms[10].Value = varbinaryStream;
            parms[11].Value = binaryStream;
            DbCommand cmd = new DbProxyCommand();

            cmd.Parameters.AddRange(parms);
            using (DbConnection conn = new DbProxyConnection())
            {
                conn.ConnectionString = proxyConnString;
                conn.Open();
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = SqlUpdateTestDbProxy;
                cmd.ExecuteNonQuery();
                conn.Close();
            }
            cmd.Parameters.Clear();
            cmd.Dispose();
        }
Beispiel #3
0
        public static void InsertTextNull(string PK)
        {
            DbCommand cmd = new DbProxyCommand();

            using (DbConnection conn = new DbProxyConnection())
            {
                conn.ConnectionString = proxyConnString;
                conn.Open();
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = string.Format("INSERT TestDbProxy VALUES('{0}', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)", PK);
                cmd.ExecuteNonQuery();
                conn.Close();
            }
            cmd.Dispose();
        }
Beispiel #4
0
        public static void DeleteText(string PK)
        {
            DbCommand cmd = new DbProxyCommand();

            using (DbConnection conn = new DbProxyConnection())
            {
                conn.ConnectionString = proxyConnString;
                conn.Open();
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = string.Format("DELETE FROM TestDbProxy WHERE PK = '{0}'", PK);
                cmd.ExecuteNonQuery();
                conn.Close();
            }
            cmd.Dispose();
        }
Beispiel #5
0
        public static void UpdateTextNull(string PK)
        {
            DbCommand cmd = new DbProxyCommand();

            using (DbConnection conn = new DbProxyConnection())
            {
                conn.ConnectionString = proxyConnString;
                conn.Open();
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.Text;
                cmd.CommandText =
                    string.Format(
                        "UPDATE TestDbProxy SET BigIntValue = NULL, IntValue = NULL, SmallIntValue = NULL, TinyIntValue = NULL, DateTimeValue = NULL, RealValue = NULL, FloatValue = NULL, VarcharText = NULL, CharText = NULL, VarbinaryStream = NULL, BinaryStream = NULL WHERE PK = '{0}'",
                        PK);
                cmd.ExecuteNonQuery();
                conn.Close();
            }
            cmd.Dispose();
        }
Beispiel #6
0
        public static void UpdateTextNormal(string PK, long bigIntValue, int intValue, short smallIntValue, byte tinyIntValue, DateTime dateTimeValue, float realValue, double floatValue, string varcharText, string charText, byte[] varbinaryStream, byte[] binaryStream)
        {
            DbCommand cmd = new DbProxyCommand();

            using (DbConnection conn = new DbProxyConnection())
            {
                conn.ConnectionString = proxyConnString;
                conn.Open();
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.Text;
                cmd.CommandText =
                    string.Format(
                        "UPDATE TestDbProxy SET BigIntValue = {1}, IntValue = {2}, SmallIntValue = {3}, TinyIntValue = {4}, DateTimeValue = '{5}', RealValue = {6}, FloatValue = {7}, VarcharText = '{8}', CharText = '{9}', VarbinaryStream = {10}, BinaryStream = {11} WHERE PK = '{0}'",
                        PK, bigIntValue, intValue, smallIntValue, tinyIntValue, dateTimeValue, realValue, floatValue,
                        varcharText, charText, BytesToString(binaryStream), BytesToString(varbinaryStream));
                cmd.ExecuteNonQuery();
                conn.Close();
            }
            cmd.Dispose();
        }
Beispiel #7
0
        public static void InsertTextNormal(string PK, long bigIntValue, int intValue, short smallIntValue, byte tinyIntValue, DateTime dateTimeValue, float realValue, double floatValue, string varcharText, string charText, byte[] varbinaryStream, byte[] binaryStream)
        {
            DbCommand cmd = new DbProxyCommand();

            using (DbConnection conn = new DbProxyConnection())
            {
                conn.ConnectionString = proxyConnString;
                conn.Open();
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.Text;
                cmd.CommandText =
                    string.Format(
                        "INSERT TestDbProxy VALUES('{0}', {1}, {2}, {3}, {4}, '{5}', {6}, {7}, '{8}', '{9}', {10}, {11})", PK,
                        bigIntValue, intValue, smallIntValue, tinyIntValue, dateTimeValue, realValue, floatValue,
                        varcharText, charText, BytesToString(binaryStream), BytesToString(varbinaryStream));
                cmd.ExecuteNonQuery();
                conn.Close();
            }
            cmd.Dispose();
        }
Beispiel #8
0
        public static void DeleteProc(string PK)
        {
            DbParameter parm = new DbProxyParameter("@PK", DbType.AnsiString, 50);

            parm.Value = PK;
            DbCommand cmd = new DbProxyCommand();

            cmd.Parameters.Add(parm);
            using (DbConnection conn = new DbProxyConnection())
            {
                conn.ConnectionString = proxyConnString;
                conn.Open();
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = SqlDeleteTestDbProxy;
                cmd.ExecuteNonQuery();
                conn.Close();
            }
            cmd.Dispose();
        }