常用OleDb连接数据库字符串和例子
来源:互联网 发布:淘宝可以自定义皮肤吗 编辑:程序博客网 时间:2024/04/29 11:39
//1.OleDbConnection.ConnectinString:
//1).oracle--->"Provider=MSDAORA/OraOledb.Oracle; Data Source=ORACLE8i7;User ID=;Password=;"
//2).access--->"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:/bin/LocalAccess40.mdb"
//3).sqlserver--->"Provider=SQLOLEDB;Data Source=MySQLServer;User ID=;Password=;"
// 4).sqlserver-->"Provider=sqloledb;database=mysqlserver;uid=pwd=;";
//常用连接数据字符串和例子
class ClassOleDb
{
private System.Data.OleDb.OleDbConnection _connection;
private System.Data.OleDb. OleDbCommand _commandCollection;
//private System.Data.OleDb.OleDbCommand[] _commandCollection;
private void InitConnection()
{
this._connection = new System.Data.OleDb.OleDbConnection();
this._connection.ConnectionString =global::MyExcel.Properties.Settings.Default.priceConnectionString;
_commandCollection = new OleDbCommand();
}
public ClassOleDb()
{
InitConnection();
}
/// <summary>
/// 输入序号返回价格
/// </summary>
/// <param name="jihao"></param>
/// <returns></returns>
public string selcet(string jihao)
{
string selectstr = "SELECT 价格 FROM jiage WHERE 序号 = '" + @jihao+"'";
_commandCollection.CommandText = selectstr;
_commandCollection.CommandType = CommandType.TableDirect;
_commandCollection.Connection= _connection;
_connection.Open();
OleDbDataReader reader = _commandCollection.ExecuteReader();
string returnvalue = "0";
if (reader.Read())
{
returnvalue = reader[0].ToString();
}
reader.Close();
_connection.Close();
return returnvalue;
}
- 常用OleDb连接数据库字符串和例子
- ODBC和OLEDB的连接字符串
- 生成ODBC和OLEDB 连接字符串
- ODBC和OLEDB的连接字符串
- ODBC和OLEDB的连接字符串
- OleDB数据库例子
- OleDb 连接字符串语法
- OLEDB连接SQL数据库
- oledb连接Access数据库
- 使用OLEDB连接数据库
- 用oledb连接数据库
- 利用VB获取基于OLEDB连接sqlserver数据库的字符串
- 数据库常用连接字符串
- C++ 使用OLEDB连接数据库
- .net之OLEDB连接数据库
- 常用连接数据库字符串信息
- 常用数据库的连接字符串
- 使用.udl快速测试与数据库的连接并得到连接字符串(OLEDB、ADO)
- Visual Basic和C#功能对比
- 获取客户端mac地址
- 自编Replace方法
- Windows API一日一练(12)TranslateAccelerator函数
- 让Redhat 9.0的xpdf打开中文PDF文档
- 常用OleDb连接数据库字符串和例子
- 多管齐下,解决dotNet FrameWork全角问题
- 【Ajax实现无刷新三联动下拉框】
- 使用Spring框架和AOP实现动态路由
- mount 命令详解
- 获取mac地址
- FileStream.Seek 方法
- Spring 2.0的新特性和应用实践
- RAS拨号SDK程序注意点