文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>ADO.NET的一段数据库操作代码

ADO.NET的一段数据库操作代码

时间:2010-10-12  来源:牛小浩

 int currentIndex = 0;
            int pageSize = 10;

            //System.Data.OracleClient.OracleConnection connection = new SqlConnection("Data Source=ORCL_100.0.3.10;User Id=btvaudit2;Password=btvaudit2;");
            //connection.Open();

            DbProviderFactory dbfactory = DbProviderFactories.GetFactory("System.Data.OracleClient");
            DbConnection dbconn = dbfactory.CreateConnection();
            dbconn.ConnectionString = "Data Source=ORCL_100.0.3.10;User Id=btvaudit2;Password=btvaudit2;";

            string orderSQL = "SELECT * FROM a_wsinterfaceinfo order by requesttime desc";

            DbCommand dbCommand = dbconn.CreateCommand();
            dbCommand.CommandText = orderSQL;
            dbCommand.CommandType = CommandType.Text;

            DbDataAdapter dbDataAdapter = dbfactory.CreateDataAdapter();
            dbDataAdapter.SelectCommand = dbCommand;

            if (System.Data.ConnectionState.Open != dbconn.State)
                dbconn.Open();

            DataSet dataSet = new DataSet();
            int count = dbDataAdapter.Fill(dataSet, currentIndex, pageSize, "a_wsinterfaceinfo");

            if (System.Data.ConnectionState.Open == dbconn.State)
                dbconn.Close();

            DataTable table =new DataTable();
            dataSet.Merge(table);

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载