惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Security Affairs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Jina AI
Jina AI
P
Palo Alto Networks Blog
GbyAI
GbyAI
大猫的无限游戏
大猫的无限游戏
A
Arctic Wolf
Hugging Face - Blog
Hugging Face - Blog
小众软件
小众软件
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
Blog — PlanetScale
Blog — PlanetScale
S
Schneier on Security
V
Vulnerabilities – Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
雷峰网
雷峰网
T
Tenable Blog
人人都是产品经理
人人都是产品经理
T
Tor Project blog
C
Cyber Attacks, Cyber Crime and Cyber Security
AWS News Blog
AWS News Blog
Microsoft Security Blog
Microsoft Security Blog
J
Java Code Geeks
Scott Helme
Scott Helme
SecWiki News
SecWiki News
C
CERT Recently Published Vulnerability Notes
Recorded Future
Recorded Future
I
InfoQ
Security Archives - TechRepublic
Security Archives - TechRepublic
Help Net Security
Help Net Security
Cloudbric
Cloudbric
C
Check Point Blog
Engineering at Meta
Engineering at Meta
TaoSecurity Blog
TaoSecurity Blog
B
Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
N
News and Events Feed by Topic
云风的 BLOG
云风的 BLOG
MyScale Blog
MyScale Blog
腾讯CDC
量子位
Application and Cybersecurity Blog
Application and Cybersecurity Blog
K
Kaspersky official blog
Vercel News
Vercel News
F
Full Disclosure
T
Troy Hunt's Blog
Forbes - Security
Forbes - Security
S
Security @ Cisco Blogs

博客园 - 丁焕轩

The SSL connection could not be established, see inner exception 错误 腾讯企业邮箱管理 万能五笔彻底删除,广告 C# 直接赋值 和 深拷贝 iis部署 访问 LINUX 基础 服务器无法从本地复制文件 修改引用api地图的样式,地图 程序用一段时间卡死、系统日志调试 博文阅读密码验证 - 博客园 sql server 常规问题 sql server 使用 elemenet 级联 博文阅读密码验证 - 博客园 utc时间戳 日期 转换 框架问题排查 FreeSql 使用说明 .net 增加 Swagger 解决跨域 oracle 服务器 客户端安装,配置
oracle 最简单连接
丁焕轩 · 2024-05-23 · via 博客园 - 丁焕轩

一、工程 生成 可能要改成x64

 /// <summary>
        /// 最简单测试 不用
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public WebResponseContent GetTest1(string pkId)
        {
            string strEms_list_no = string.Empty;
            try
            {
                //从Oracle数据库中读取时间信息              
                string conn = string.Concat(
                    @"Data Source=",
                    @"    (DESCRIPTION=",
                    @"        (ADDRESS_LIST=",
                    @"            (ADDRESS=",
                    @"                (PROTOCOL=TCP)",
                    @"                (HOST=jdepy-cluster.mflex.com)",
                    @"                (PORT=1521)",
                    @"            )",
                    @"        )",
                    @"        (CONNECT_DATA=",
                    @"            (SERVICE_NAME=SZBOOK)",
                    @"        )",
                    @"    );",
                    @"Persist Security Info=True;",
                    @"User Id=mid_cms;",
                    @"Password=eport"
                    );

                //OracleConnection 被标注为已过时
                OracleConnection oc = new OracleConnection(conn);

                try
                {
                    oc.Open();
                    //OracleCommand 被标注为已过时
                    OracleCommand cmd = oc.CreateCommand();
                    cmd.CommandText = "select * from v_logistics_data where ems_list_no='" + pkId + "'";
                    OracleDataReader odr = cmd.ExecuteReader();

                    while (odr.Read())
                    {
                        strEms_list_no = odr.GetString(0);
                        //Console.WriteLine(odr.GetOracleDateTime(0).ToString());

                    }

                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                finally
                {
                    oc.Close();
                }

                return webResponse.OK(null, strEms_list_no);
            }
            catch (Exception ex)
            {
                return webResponse.Error(ex.ToString());
            }
        }

View Code