请用
try{
OleDbConnection thisConnection=new OleDbConnection(aa);
OleDbDataAdapter disAdapter=new OleDbDataAdapter("SELECT 工况,节点号,D1,D2,D3 FROM displacement",thisConnection);
OleDbCommandBuilder disBuilder=new OleDbCommandBuilder(disAdapter);
DataSet disDataSet=new DataSet();
disAdapter.Fill(disDataSet,"displacement");
}
catch(OleDbException w){
MessageBox.Show("Error code= "+ w.ErrorCode.ToString("X")+"\nError Description="+w.Message);
}
仔细测试
try{
OleDbConnection thisConnection=new OleDbConnection(aa);
OleDbDataAdapter disAdapter=new OleDbDataAdapter("SELECT 工况,节点号,D1,D2,D3 FROM displacement",thisConnection);
OleDbCommandBuilder disBuilder=new OleDbCommandBuilder(disAdapter);
DataSet disDataSet=new DataSet();
disAdapter.Fill(disDataSet,"displacement");
}
catch(OleDbException w){
MessageBox.Show("Error code= "+ w.ErrorCode.ToString("X")+"\nError Description="+w.Message);
}
仔细测试
Jet OLEDB:ODBC Command Time Out
Jet OLEDB:Max Locks Per File
Jet OLEDB:Implicit Commit Sync
Jet OLEDB:Flush Transaction Timeout
Jet OLEDB:Lock Delay
Jet OLEDB:Max Buffer Size
Jet OLEDB:User Commit Sync
Jet OLEDB:Lock Retry
Jet OLEDB:Exclusive Async Delay
Jet OLEDB:Shared Async Delay
Jet OLEDB:Page Timeout
Jet OLEDB:Recycle Long-Valued Pages
Jet OLEDB:Reset ISAM Stats
Jet OLEDB:Connection Control
Jet OLEDB:ODBC Parsing
Jet OLEDB:Page Locks to Table Lock
Jet OLEDB:Sandbox Mode
Jet OLEDB:Transaction Commit Mode
RESOLUTION
In ADO 2.7 or earlier, you can set the provider-specific properties after you establish a connection to the database. For example: Dim cnn As New ADODB.Connection
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;"
cnn.Properties("Jet OLEDB:Max Buffer Size") = 256
In ADO.NET, you cannot set OLE DB session-level, provider-specific properties. Because ADO.NET is a disconnected model, you do not typically have to set these properties unless you have a live connection to the database.