string conStr="Provider=Microsoft.JET.OLEDB.4.0;data source="+Path.GetFullPath("..\\..\\northwind.mdb").ToString();
string str="select * from 雇员";
try
{
OleDbConnection myConnection=new OleDbConnection();
myConnection.ConnectionString=conStr;
myConnection.Open();
OleDbDataAdapter myAdapter=new OleDbDataAdapter(str,myConnection);
DataSet ds=new DataSet();
myAdapter.Fill(ds,"Employee");
dataGrid1.SetDataBinding(ds,"Employee");
myConnection.Close();
myAdapter.Dispose();
}
catch
{
MessageBox.Show("数据库连接出错!!!");
}
string str="select * from 雇员";
try
{
OleDbConnection myConnection=new OleDbConnection();
myConnection.ConnectionString=conStr;
myConnection.Open();
OleDbDataAdapter myAdapter=new OleDbDataAdapter(str,myConnection);
DataSet ds=new DataSet();
myAdapter.Fill(ds,"Employee");
dataGrid1.SetDataBinding(ds,"Employee");
myConnection.Close();
myAdapter.Dispose();
}
catch
{
MessageBox.Show("数据库连接出错!!!");
}
2。这个连接的连接字符串就是你要的东西