示例#1
0
        public static void QueryProcNormalByOutput(string PK, out long bigIntValue, out int intValue, out short smallIntValue, out byte tinyIntValue, out DateTime dateTimeValue, out float realValue, out double floatValue, out string varcharText, out string charText, out byte[] varbinaryStream, out byte[] binaryStream)
        {
            DbParameter[] parms = GetParameters();
            parms[0].Value = PK;
            for (int i = 1; i < parms.Length; i++)
            {
                parms[i].Direction = ParameterDirection.Output;
            }
            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 = SqlQueryTestDbProxyOutput;
                cmd.ExecuteNonQuery();
            }
            bigIntValue     = (long)parms[1].Value;
            intValue        = (int)parms[2].Value;
            smallIntValue   = (short)parms[3].Value;
            tinyIntValue    = (byte)parms[4].Value;
            dateTimeValue   = (DateTime)parms[5].Value;
            realValue       = (float)parms[6].Value;
            floatValue      = (double)parms[7].Value;
            varcharText     = (string)parms[8].Value;
            charText        = (string)parms[9].Value;
            varbinaryStream = (byte[])parms[10].Value;
            binaryStream    = (byte[])parms[11].Value;

            cmd.Parameters.Clear();
            cmd.Dispose();
        }
示例#2
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();
        }
示例#3
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();
        }
示例#4
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();
        }
示例#5
0
        public static void AccessTimeout()
        {
            DbCommand cmd = new DbProxyCommand();

            using (DbConnection conn = new DbProxyConnection())
            {
                conn.ConnectionString = proxyConnString;
                conn.Open();
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = SqlAccessTimeout;
                cmd.ExecuteNonQuery();
            }
            cmd.Parameters.Clear();
            cmd.Dispose();
        }
示例#6
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();
        }
示例#7
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();
        }
示例#8
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();
        }
示例#9
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();
        }
示例#10
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();
        }