C#链access 之前一直用链接sqlserver的函数做程序,一直出错,现在可以了
作者:Else 's Blog
地址:http://www.aixq.com/post/893/
版权所有。转载时必须链接形式注明作者和原始出处及本声明! 在
中查看更多“C#连接Access成功”相关内容
在
中查看更多“C#连接Access成功”相关内容
在
中查看更多“C#连接Access成功”相关内容
在
中查看更多“C#连接Access成功”相关内容
在
中查看更多“C#连接Access成功”相关内容
在
中查看更多“C#连接Access成功”相关内容
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OleDb;
namespace test.src.util
{
public class DbConnction
{
public DbConnction()
{
//
}
static void Main(string[] args)
{
String connectionString = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=";
connectionString += @"d:\data.mdb";
OleDbConnection myConnection = new OleDbConnection(connectionString);
myConnection.Open(); //打开数据库链接
OleDbCommand myCommand = myConnection.CreateCommand(); //定义SqlCommand变量
myCommand.CommandText = "select * from ruby"; //设置SQL语句
OleDbDataReader myDataReader = myCommand.ExecuteReader(); // 从数据库获职数据
//读取DataReader中的数据并输出
while (myDataReader.Read())
{
Console.WriteLine("\t{0}\t{1}", myDataReader["id"], myDataReader["title"]);
}
myDataReader.Close(); //关闭SqlDataReader
myConnection.Close(); //关闭链接
Console.WriteLine("这个是一个链接的测试");
}
}
}
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OleDb;
namespace test.src.util
{
public class DbConnction
{
public DbConnction()
{
//
}
static void Main(string[] args)
{
String connectionString = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=";
connectionString += @"d:\data.mdb";
OleDbConnection myConnection = new OleDbConnection(connectionString);
myConnection.Open(); //打开数据库链接
OleDbCommand myCommand = myConnection.CreateCommand(); //定义SqlCommand变量
myCommand.CommandText = "select * from ruby"; //设置SQL语句
OleDbDataReader myDataReader = myCommand.ExecuteReader(); // 从数据库获职数据
//读取DataReader中的数据并输出
while (myDataReader.Read())
{
Console.WriteLine("\t{0}\t{1}", myDataReader["id"], myDataReader["title"]);
}
myDataReader.Close(); //关闭SqlDataReader
myConnection.Close(); //关闭链接
Console.WriteLine("这个是一个链接的测试");
}
}
}
作者:Else 's Blog
地址:http://www.aixq.com/post/893/
版权所有。转载时必须链接形式注明作者和原始出处及本声明!
中查看更多“C#连接Access成功”相关内容
中查看更多“C#连接Access成功”相关内容
中查看更多“C#连接Access成功”相关内容
中查看更多“C#连接Access成功”相关内容
中查看更多“C#连接Access成功”相关内容
中查看更多“C#连接Access成功”相关内容
php地址栏的参数
学java吧


2007/12/24 00:48 | by 
