C#連接ODBC數(shù)據(jù)源的方法
更新時間:2015年04月04日 17:03:13 作者:令狐不聰
這篇文章主要介紹了C#連接ODBC數(shù)據(jù)源的方法,實(shí)例分析了C#連接ODBC操作數(shù)據(jù)庫的技巧,非常具有實(shí)用價值,需要的朋友可以參考下
本文實(shí)例講述了C#連接ODBC數(shù)據(jù)源的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:
復(fù)制代碼 代碼如下:
// 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#程序設(shè)計有所幫助。
您可能感興趣的文章:
- C#通過oledb訪問access數(shù)據(jù)庫的方法
- C#基于OLEDB獲取Excel文件表結(jié)構(gòu)信息的方法
- C#實(shí)現(xiàn)Access通用訪問類OleDbHelper完整實(shí)例
- C#使用oledb導(dǎo)出數(shù)據(jù)到excel的方法
- C#使用oledb操作excel文件的方法
- C#使用oledb讀取excel表格內(nèi)容到datatable的方法
- C#連接MySql數(shù)據(jù)庫的方法
- C# 連接SQL數(shù)據(jù)庫的方法及常用連接字符串
- c#連接sqlserver數(shù)據(jù)庫、插入數(shù)據(jù)、從數(shù)據(jù)庫獲取時間示例
- 深入分析C#連接Oracle數(shù)據(jù)庫的連接字符串詳解
- C#利用ODP.net連接Oracle數(shù)據(jù)庫的操作方法
- C#連接mysql數(shù)據(jù)庫完整實(shí)例
- C#使用ODBC與OLEDB連接數(shù)據(jù)庫的方法示例
相關(guān)文章
C#模擬http 發(fā)送post或get請求的簡單實(shí)例
下面小編就為大家?guī)硪黄狢#模擬http 發(fā)送post或get請求的簡單實(shí)例。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-06-06基于C#實(shí)現(xiàn)簡單的二維碼和條形碼的生成工具
這篇文章主要為大家詳細(xì)介紹了如何基于C#實(shí)現(xiàn)簡單的二維碼和條形碼工具,用于二維碼條形碼的生成與識別,感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下2023-12-12C#判斷程序是否是管理員權(quán)限運(yùn)行的方法代碼示例
這篇文章主要介紹了C#判斷程序是否是管理員權(quán)限運(yùn)行的方法代碼示例,本文直接給出實(shí)現(xiàn)代碼例子,需要的朋友可以參考下2015-03-03協(xié)定需要會話,但是綁定“BasicHttpBinding”不支持它或者因配置不正確而無法支持它
在IIS7及以上版本服務(wù)器中提供了基于WAS的無.SVC文件的WCF服務(wù)激活功能,能夠提供基于HTTP和非HTTP協(xié)議的訪問,通過添加Windows Server AppFabric可以更方便的管理WCF服務(wù)2012-12-12