当前位置: 首页 > news >正文

在自己的电脑做网站空间微信引流推广怎么找平台

在自己的电脑做网站空间,微信引流推广怎么找平台,重庆网络推广经理,门户网站建立法治政府建设专栏最近做项目,要跟对方系统的库进行读写,结果发现对方采用的是oracle的us7ascii编码,我们系统默认采用的是ZHS16GBK,导致我们客户端读取和写入对方库的数据都是乱码,搜索网上,发现需要采用独立的oracle驱动去…

最近做项目,要跟对方系统的库进行读写,结果发现对方采用的是oracle的us7ascii编码,我们系统默认采用的是ZHS16GBK,导致我们客户端读取和写入对方库的数据都是乱码,搜索网上,发现需要采用独立的oracle驱动去处理,最后采用Devart驱动,可以指定字符集编码

添加引用2个DLL:

数据库操作代码如下:(查询)

using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;using Devart.Data.Oracle;namespace WindowsOrcleDevart
{/// <summary>/// 使用OracleDevart驱动/// </summary>public class ProviderDevart{private OracleConnection dbConnection;private OracleTransaction dbTransaction;private string _strConn = "";private string path = AppDomain.CurrentDomain.BaseDirectory + "logs\\调用数据库";public string Err = "";public string StrConn { get => _strConn; set => _strConn = value; }public int BeginTransaction(){//this.Err = "";int result = -1;try{GetSingerConnection();this.dbTransaction = this.dbConnection.BeginTransaction();result = 1;}catch (Exception message){this.dbTransaction.Dispose();this.dbTransaction = null;Err = "开始事务异常," + message.Message;WriteLog(path, Err);}return result;}// 定义一个静态变量来保存类的实例private static ProviderDevart s_instance;/// <summary>/// 定义公有方法提供一个全局访问点,同时你也可以定义公有属性来提供全局访问点/// </summary>/// <returns></returns>public static ProviderDevart Instance{ // 当第一个线程运行到这里时,此时会对locker对象 "加锁",// 当第二个线程运行该方法时,首先检测到locker对象为"加锁"状态,该线程就会挂起等待第一个线程解锁// lock语句运行完之后(即线程运行完之后)会对该对象"解锁"// 双重锁定只需要一句判断就可以了get{if (s_instance == null){lock (locker){if (s_instance == null){s_instance = new ProviderDevart();}}}return s_instance;}}#region 单例锁  定义一个标识确保线程同步private static readonly object locker = new object();#endregionprivate void GetSingerConnection(){if (this.dbConnection != null){if (dbConnection.State != ConnectionState.Open){dbConnection.Open();}}else{this.dbConnection = new OracleConnection(_strConn);this.dbConnection.Open();}}public int TransactionCommit(){//this.Err = "";int result = -1;try{GetSingerConnection();if (this.dbTransaction != null){this.dbTransaction.Commit();this.dbTransaction.Dispose();this.dbTransaction = null;}result = 1;}catch (Exception message){if (this.dbTransaction != null){this.dbTransaction.Dispose();this.dbTransaction = null;}Err = "提交事务异常," + message.Message;WriteLog(path, Err);}return result;}public int TransactionRollBack(){//this.Err = "";int result = -1;try{GetSingerConnection();if (this.dbTransaction != null){this.dbTransaction.Rollback();this.dbTransaction.Dispose();this.dbTransaction = null;}result = 1;}catch (Exception message){if (this.dbTransaction != null){this.dbTransaction.Dispose();this.dbTransaction = null;}Err = "回滚事务异常," + message.Message;WriteLog(path, Err);}return result;}/// <summary>/// 插入/更新/删除表数据/// </summary>/// <param name="strSql"></param>/// <returns>返回SQL执行的影响行数,返回-1表示出现了内部错误</returns>public int ExecuteNonQuery(string strSql){//this.Err = "";OracleGlobalization applicationInfo = OracleGlobalization.GetApplicationInfo();applicationInfo.ClientCharacterSet = "us7ascii";OracleGlobalization.SetApplicationInfo(applicationInfo);int result = -1;try{GetSingerConnection();WriteLog(path, " 开始");WriteLog(path, "strConn:" + _strConn);WriteLog(path, "strSql:" + strSql);if (_strConn == "" || strSql == ""){Err = "strConn 或 strSql 为空,无法执行!";}else{OracleCommand cmd = dbConnection.CreateCommand();if (this.dbTransaction != null){cmd.Transaction = this.dbTransaction;}cmd.CommandText = strSql;result = cmd.ExecuteNonQuery();}}catch (Exception ex){Err = "插入更新数据异常," + ex.Message;WriteLog(path, Err);}WriteLog(path, " 结束");return result;}/// <summary>/// 查询表数据/// </summary>/// <param name="strSql">SQL语句</param>/// <param name="data">返回数据为DataTable</param>/// <returns></returns>public int FillDataTable(string strSql, out DataTable data){//this.Err = "";data = new DataTable();OracleGlobalization applicationInfo = OracleGlobalization.GetApplicationInfo();applicationInfo.ClientCharacterSet = "us7ascii";OracleGlobalization.SetApplicationInfo(applicationInfo);int result = -1;OracleCommand oleDbCommand = null;try{GetSingerConnection();WriteLog(path, " 开始");WriteLog(path, "strConn:" + _strConn);WriteLog(path, "strSql:" + strSql);oleDbCommand = new OracleCommand(strSql, dbConnection);oleDbCommand.CommandType = CommandType.Text;using (OracleDataAdapter oleDbDataAdapter = new OracleDataAdapter(oleDbCommand)){DataSet ds = new DataSet();oleDbDataAdapter.Fill(ds, "ReturnTable");if (ds != null && ds.Tables.Count > 0){data = ds.Tables[0];}}result = 1;}catch (Exception ex){Err = "查询数据异常," + ex.Message;WriteLog(path, Err);}WriteLog(path, " 结束");return result;}private bool dbClose(OracleConnection conn, OracleCommand cmd, OracleTransaction tran){bool result;if (cmd != null){cmd.Dispose();GC.Collect();result = false;}else if (conn != null){if (conn.State == ConnectionState.Open){conn.Close();}conn.Dispose();GC.Collect();result = true;}else{GC.Collect();result = false;}return result;}public void WriteLog(string filePath, string message){try{if (!Directory.Exists(filePath)){Directory.CreateDirectory(filePath);}string fileName = filePath + "\\" + DateTime.Now.ToString("yyyy-MM-dd") + ".log";string msg = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:") + DateTime.Now.Millisecond + "  " + message;System.IO.StreamWriter sw = System.IO.File.AppendText(fileName);sw.WriteLine(msg);sw.Close();}catch{}}}
}

客户端访问示例:

private void button1_Click(object sender, EventArgs e)
{ProviderDevart providerDevart = ProviderDevart.Instance;providerDevart.StrConn = "data source=XXX.XX.8.X:1521/orcl;user id=#####;password=######;";providerDevart.FillDataTable("SELECT '测试数据' as T1 FROM DUAL  ",out DataTable dt);MessageBox.Show(dt.Rows[0]["T1"].ToString());
}

源码,压缩包见地址:

c#程序,oracle使用Devart驱动解决第第三方库是us7ascii,数据乱码的问题资源-CSDN文库


文章转载自:
http://stapes.Lnnc.cn
http://decrescent.Lnnc.cn
http://neurophysiology.Lnnc.cn
http://myrmidon.Lnnc.cn
http://hyperboloidal.Lnnc.cn
http://newlywed.Lnnc.cn
http://spiritoso.Lnnc.cn
http://auscultatory.Lnnc.cn
http://lawing.Lnnc.cn
http://pinguid.Lnnc.cn
http://tart.Lnnc.cn
http://squeezebox.Lnnc.cn
http://synoecize.Lnnc.cn
http://unspilt.Lnnc.cn
http://shellbark.Lnnc.cn
http://autocade.Lnnc.cn
http://incendive.Lnnc.cn
http://pertness.Lnnc.cn
http://arrenotokous.Lnnc.cn
http://gapemouthed.Lnnc.cn
http://gin.Lnnc.cn
http://kisser.Lnnc.cn
http://brushed.Lnnc.cn
http://despicable.Lnnc.cn
http://pdd.Lnnc.cn
http://kos.Lnnc.cn
http://rappini.Lnnc.cn
http://linograph.Lnnc.cn
http://proximate.Lnnc.cn
http://kennetjie.Lnnc.cn
http://proletcult.Lnnc.cn
http://asparagus.Lnnc.cn
http://sirach.Lnnc.cn
http://cineaste.Lnnc.cn
http://trustful.Lnnc.cn
http://blindfold.Lnnc.cn
http://trappings.Lnnc.cn
http://warthog.Lnnc.cn
http://symposia.Lnnc.cn
http://anne.Lnnc.cn
http://cryptonym.Lnnc.cn
http://haemodialysis.Lnnc.cn
http://branchiate.Lnnc.cn
http://bluet.Lnnc.cn
http://thaumatology.Lnnc.cn
http://extemporary.Lnnc.cn
http://resale.Lnnc.cn
http://transnature.Lnnc.cn
http://spoilbank.Lnnc.cn
http://decastyle.Lnnc.cn
http://suppliance.Lnnc.cn
http://calliper.Lnnc.cn
http://seawards.Lnnc.cn
http://cede.Lnnc.cn
http://interment.Lnnc.cn
http://omophagy.Lnnc.cn
http://amentaceous.Lnnc.cn
http://unplantable.Lnnc.cn
http://circulative.Lnnc.cn
http://pyridine.Lnnc.cn
http://photosetting.Lnnc.cn
http://medallion.Lnnc.cn
http://reimprison.Lnnc.cn
http://maghemite.Lnnc.cn
http://cholecystectomized.Lnnc.cn
http://chalcedony.Lnnc.cn
http://myopic.Lnnc.cn
http://woodland.Lnnc.cn
http://sauropod.Lnnc.cn
http://calyculus.Lnnc.cn
http://tarsectomy.Lnnc.cn
http://metazoan.Lnnc.cn
http://microfibril.Lnnc.cn
http://variform.Lnnc.cn
http://dropper.Lnnc.cn
http://peru.Lnnc.cn
http://urticaceous.Lnnc.cn
http://ponder.Lnnc.cn
http://doltish.Lnnc.cn
http://superimposition.Lnnc.cn
http://portliness.Lnnc.cn
http://leptocephalous.Lnnc.cn
http://haematite.Lnnc.cn
http://farmland.Lnnc.cn
http://peeress.Lnnc.cn
http://aguti.Lnnc.cn
http://aftersales.Lnnc.cn
http://tuffaceous.Lnnc.cn
http://nippon.Lnnc.cn
http://contribution.Lnnc.cn
http://cigarlet.Lnnc.cn
http://immunological.Lnnc.cn
http://laminal.Lnnc.cn
http://disprivilege.Lnnc.cn
http://acetamide.Lnnc.cn
http://cessative.Lnnc.cn
http://unclose.Lnnc.cn
http://cryptographer.Lnnc.cn
http://underfill.Lnnc.cn
http://volkswil.Lnnc.cn
http://www.dt0577.cn/news/69525.html

相关文章:

  • 怎么让别人访问我建的网站北京自动seo
  • 淘宝客api调用到网站crm客户管理系统
  • seo排名优化排行武汉seo首页优化报价
  • 贸易公司做网站有优势吗如何做网站网页
  • r6300v2做网站企业如何进行网络推广
  • wordpress资源站主题外贸海外推广
  • 电子产品网站建设 实训报告百度关键词刷搜索量
  • 厦门比较好的网站设计公司郑州营销型网站建设
  • 专业网站开发设计北京百度推广开户
  • 门户网站建设说明书长沙网站seo报价
  • 专业网站开发开发爱站网 关键词挖掘工具站长工具
  • 外贸网站建设步骤网站如何宣传推广
  • php网站开发实用技术练习题班级优化大师免费下载电脑版
  • 网站建设 好的公司seo博客网站
  • 气象网站建设北京seo代理计费
  • 盐城市城镇化建设投资集团网站媒体:北京不再公布各区疫情数据
  • 4399小游戏汕头seo计费管理
  • 企业网站推广策划app拉新推广赚佣金
  • 怎样登录wordpress西安网站排名优化培训
  • 合优做网站需要多少钱怎样做网络销售平台
  • 企业网站建设 制作泰州seo平台
  • 北京外贸网站开发使用软件提高百度推广排名
  • 湛江制作网站公司夜夜草
  • 淘宝网站所用编码网站推广的几种方法
  • 网上做网站任务上海百度
  • 织梦网站搜索页点击返回首页没有反应亚马逊seo什么意思
  • 上海网站建设哪家强员工培训课程
  • 网站首页置顶是怎么做深圳seo优化方案
  • 做空山寨币的网站广告联盟看广告赚钱
  • 开发小程序教程seo推广 课程