C#连接Access数据库问题 - .NET技术 / C#
我写了一段很简单的用ado.net连接数据库的代码,可是运行后提示没事可安装的ISAM!
这是什么意思?我该怎么做才能正常连接。
代码如下:
C# code:
static void Main(string[] args)
{
OleDbConnection thisConnection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=Human.mdb");
thisConnection.Open();
OleDbCommand thisCommand = thisConnection.CreateCommand();
thisCommand.CommandText = "SELECT xm,xb from human";
OleDbDataReader thisReader = thisCommand.ExecuteReader();
while(thisReader .Read())
{
Console.WriteLine("\t{0}\t{1}",thisReader["xm"],thisReader ["xb"]);
}
thisReader.Close ();
thisConnection.Close();
Console .Write ("Program finished,press Enter/Return to continue:");
Console.ReadLine();
}
连接字符串不正确。
谢谢啊 原来是这样啊
相关问答:
挺繁琐,之前发的帖子,分值太低现在重发一个。欢迎各位大侠~~
#include "stdlib.h"
#include "math.h"
#include "stdio.h"
float objfx(float x[]);
void constraint(float x[] ......
使用ACCESS最大的隐患就是不安全。今天对ACCESS数据库设置了一个密码,必须使用密码才能打开,但是在程序中却无法连接数据库了。大家知道使用用户名和密码,如何连接ACCESS数据库?貌似ACCESS的用户名还不知道?只知 ......