C#连接ODBC数据源的方法
程序员文章站
2024-01-27 21:13:40
本文实例讲述了c#连接odbc数据源的方法。分享给大家供大家参考。具体实现方法如下:
复制代码 代码如下:// namespaces, variables, and co...
本文实例讲述了c#连接odbc数据源的方法。分享给大家供大家参考。具体实现方法如下:
复制代码 代码如下:
// namespaces, variables, and constants
using system;
using system.configuration;
using system.data;
using system.data.odbc;
private void cbutton_click(object sender, system.eventargs e)
{
// create the dataadapter.
string sql = "select id, name from products";
odbcdataadapter da = new odbcdataadapter(sql,configurationsettings.appsettings["connectionstring1"]);
// create the table, fill it, and bind the default view to the grid.
datatable dt = new datatable( );
da.fill(dt);
}
using system;
using system.configuration;
using system.data;
using system.data.odbc;
private void cbutton_click(object sender, system.eventargs e)
{
// create the dataadapter.
string sql = "select id, name from products";
odbcdataadapter da = new odbcdataadapter(sql,configurationsettings.appsettings["connectionstring1"]);
// create the table, fill it, and bind the default view to the grid.
datatable dt = new datatable( );
da.fill(dt);
}
希望本文所述对大家的c#程序设计有所帮助。
上一篇: mysql 5.5.56免安装版配置方法
推荐阅读
-
PHP中使用localhost连接Mysql不成功的解决方法_PHP
-
thinkphp中连接oracle时封装方法无法用的解决办法
-
创建类的方法来连接数据库,大家来看看。解决办法
-
Java使用JDBC连接mysql数据库及测试是否连接成功的方法
-
PHP中使用localhost连接Mysql不成功的解决方法,localhostmysql
-
Win7下MySQL的ODBC数据源配置及PDM导入_MySQL
-
php连接与操作PostgreSQL数据库的方法
-
odbc 方式连接mssql时候,php函数的变化,以上代码该怎么书写
-
PHP在Linux下连接MSSQLServer的配置方法简述(一、Sybase库)_PHP
-
解决file_get_contents无法请求https连接的方法