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

推荐订阅源

Forbes - Security
Forbes - Security
GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
SegmentFault 最新的问题
Y
Y Combinator Blog
Recorded Future
Recorded Future
博客园 - Franky
I
InfoQ
T
The Blog of Author Tim Ferriss
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
T
Tailwind CSS Blog
Cyberwarzone
Cyberwarzone
The Register - Security
The Register - Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
雷峰网
雷峰网
P
Palo Alto Networks Blog
G
GRAHAM CLULEY
Cloudbric
Cloudbric
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
MongoDB | Blog
MongoDB | Blog
F
Full Disclosure
Google DeepMind News
Google DeepMind News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Check Point Blog
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
T
Threat Research - Cisco Blogs
U
Unit 42
N
Netflix TechBlog - Medium
The Cloudflare Blog
Spread Privacy
Spread Privacy
Microsoft Azure Blog
Microsoft Azure Blog
美团技术团队
T
Troy Hunt's Blog
Engineering at Meta
Engineering at Meta
H
Heimdal Security Blog
TaoSecurity Blog
TaoSecurity Blog
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tenable Blog
B
Blog
S
Securelist
H
Hacker News: Front Page
Google Online Security Blog
Google Online Security Blog
G
Google Developers Blog

博客园 - 丁焕轩

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