社区
C#
帖子详情
oledb,sqlclient,odbc各自在什么时候用比较合适呢?
freeleo
2003-05-22 10:41:50
可以比较一下吗?
我现在觉得:oledb-sqlserver,access
odbc--most database
sqlclient: sqlserver的常用控制
请各位指教
...全文
53
4
打赏
收藏
oledb,sqlclient,odbc各自在什么时候用比较合适呢?
可以比较一下吗? 我现在觉得:oledb-sqlserver,access odbc--most database sqlclient: sqlserver的常用控制 请各位指教
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
ArLi2003
2003-05-30
打赏
举报
回复
sqlclient 必须是sqlserver 6
oledb 可以支持access\excel\text\sqlserver 大多数的库,兼容性最好,但失去了sql 专有的功能,如果server 是sql 则不推荐使用oledb,速度会降
odbc 是一个驱动群,支持大多数的数据库,比如foxpro\dbase 之类的,包括oracle和infomix,提供一个公用的接口,可以兼容oledb 命令而模拟达到库源无关性,最重要的作用是在域服务器上由管理员控制它的映射(dsn)以便于负责平衡部署
freeleo
2003-05-29
打赏
举报
回复
up
freeleo
2003-05-23
打赏
举报
回复
up
TheAres
2003-05-22
打赏
举报
回复
sqlclient: sqlserver 6.5以上。
oledb-sqlserver 6.5 ,access,Excel
odbc--most database
.NET通用数据库操作帮助类,可支持
Odbc
、
OleDb
、Oracle
Client
、
Sql
Client
、
Sql
ServerCe等
.NET通用数据库操作帮助类,可支持
Odbc
、
OleDb
、Oracle
Client
、
Sql
Client
、
Sql
ServerCe等多种数据库提供程序操作
c#各种方式连接数据库
C#各种数据库连接的写法,有(
OLEDB
,
ODBC
,VIP,
SQL
Client
等等)
支持多数据库操作的dll
DBLibrary.dll 可方便的在多数据库之间切换,支持
Sql
Client
,Oracle
Client
OLEDB
,
ODBC
数据源 且支持存储过程和数据库事务 操作简单 附件附类视图与简单例子
c#.net 通用的数据访问类
c#写的数据访问类 /// /// 通用数据库访问类-UniversalDAL类, /// 支持
Sql
Client
、
OleDb
、
Odbc
、Oracle
Client
等 /// 不同类型的数据源
c# DBF数据库导入导出实例
c# DBF数据库导入导出实例 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Data.
Odbc
; using System.Data.
Sql
Client
; namespace DbfExample { public partial class Form1 : Form { System.Data.
Odbc
.
Odbc
Connection conn; public Form1() { InitializeComponent(); } //导出数据 private void btnOut_Click(object sender, EventArgs e) { string connect = "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=c:\\; ";
Odbc
Connection myconn = new
Odbc
Connection(connect); string
sql
t ="CREATE TABLE aa.DBF (cc int(10))"; myconn.Open();
Odbc
Command olec = new
Odbc
Command(
sql
t, myconn); try { int i = olec.ExecuteNonQuery(); MessageBox.Show("'" + i + "'success"); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { olec.Dispose(); myconn.Close(); } //string ole_connstring = @"Provider=microsoft.jet.
oledb
.5.0;Data Source=D:\;"; //System.Data.
OleDb
.
OleDb
Connection ole_conn = new System.Data.
OleDb
.
OleDb
Connection(ole_connstring); //try //{ // ole_conn.Open(); // System.Data.
OleDb
.
OleDb
Command cmd1 = new System.Data.
OleDb
.
OleDb
Command // ("Create Table TestTable (Field1 int, Field2 char(10),Field float(10,2))", // ole_conn); // System.Data.
OleDb
.
OleDb
Command cmd2 = new System.Data.
OleDb
.
OleDb
Command // ("Insert Into TestTable values (1,'Hello3',520.20)", ole_conn); // System.Data.
OleDb
.
OleDb
Command cmd3 = new System.Data.
OleDb
.
OleDb
Command // ("Insert Into TestTable values (2,'Hello4',18076.60)", ole_conn); // cmd1.ExecuteNonQuery(); // cmd2.ExecuteNonQuery(); // cmd3.ExecuteNonQuery(); //} //catch (Exception ex) //{ // MessageBox.Show(ex.Message); //} //finally //{ // ole_conn.Close(); //} } //导入数据 private void btnIn_Click(object sender, EventArgs e) { } private void Form1_Load(object sender, EventArgs e) { Bind(); } private void Bind() { try { conn = new System.Data.
Odbc
.
Odbc
Connection(); string table = @"C:\测试例子\Dbf\prepur.dbf"; string connStr = @"Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=" + table + ";Exclusive=No;NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO"; conn.ConnectionString = connStr; conn.Open(); string
sql
= @"select * from " + table;
Odbc
DataAdapter da = new
Odbc
DataAdapter(
sql
, conn); DataTable dt = new DataTable(); da.Fill(dt); this.dataGridView1.DataSource = dt.DefaultView; //MessageBox.Show(dt.Rows[0][0].ToString()); } catch { } finally { conn.Close(); } } private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { conn = new System.Data.
Odbc
.
Odbc
Connection(); string table = @"C:\测试例子\Dbf\table1.dbf"; string connStr = @"Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=" + table + ";Exclusive=No;NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO"; conn.ConnectionString = connStr; conn.Open(); string id = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); string
sql
= @"select * from " + table + " where id='" + id + "'";
Odbc
DataAdapter da = new
Odbc
DataAdapter(
sql
, conn); DataTable dt = new DataTable(); da.Fill(dt); txtId.Text = id; txtName.Text = dt.Rows[0]["name"].ToString(); txtAddress.Text = dt.Rows[0]["address"].ToString(); } catch { } finally { conn.Close(); } } private void Add() { conn = new System.Data.
Odbc
.
Odbc
Connection(); string table = @"C:\temp\Dbf\table1.dbf"; string connStr = @"Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=" + table + ";Exclusive=No;NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO"; conn.ConnectionString = connStr; conn.Open();
Odbc
Command cmd = new
Odbc
Command(); cmd.Connection = conn; string
sql
= "insert into " + table + " values('" + txtId.Text + "','" + txtName.Text + "','" + txtAddress.Text + "')"; cmd.CommandText =
sql
; cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); Bind(); } private void btnTO
SQL
_Click(object sender, EventArgs e) { try { string
sql
= "Insert Into dbfto
sql
select * From openrowset('MSDA
SQL
','Driver=Microsoft Visual FoxPro Driver;SourceType=DBF;SourceDB=C:\\temp\\Dbf','select * from table1.dbf')";
Sql
Connection con = new
Sql
Connection("server=.;database=labelprint;uid=sa;pwd=sa"); con.Open();
Sql
Command cmd = new
Sql
Command(
sql
, con); cmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }
C#
110,535
社区成员
642,575
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章