コード例 #1
0
ファイル: DbProxyDal.cs プロジェクト: fangld/MapleDB
        public static void QueryProcNormalByScalar(string PK, out int linenum, out int returnValue)
        {
            DbParameter returnParm = new DbProxyParameter("@RETURN_VALUE", DbType.Int32);

            returnParm.Direction = ParameterDirection.ReturnValue;
            DbParameter pkParm = new DbProxyParameter("@PK", DbType.AnsiString, 50);

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

            cmd.Parameters.Add(returnParm);
            cmd.Parameters.Add(pkParm);
            using (DbConnection conn = new DbProxyConnection())
            {
                conn.ConnectionString = proxyConnString;
                conn.Open();
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = SqlQueryTestDbProxyCount;
                linenum         = (int)cmd.ExecuteScalar();
            }
            returnValue = (int)returnParm.Value;
            cmd.Parameters.Clear();
            cmd.Dispose();
        }