欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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);
}

希望本文所述对大家的c#程序设计有所帮助。