未处理的“System.Data.OleDb.OleDbException”类型的异常出现在system.data.dll中
主要代码:是在form里的
usingSystem;
usingSystem.Data;
usingSystem.Data;
usingSystem.Data.OleDb;
usingSystem.Drawing;
usingSystem.Collections;
usingSystem.ComponentModel;
usingSystem.Windows.Forms;
OleDbConnectionconnection1=newOleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;"+"DataSource=c:db.mdb");
stringsql="selectname,passwordfromuserwherename='"+textBox1.Text+"'";
connection1.Open();
OleDbDataAdapteradp=newOleDbDataAdapter(sql,connection1);
DataSetds=newDataSet();
adp.Fill(ds);就是这行代码有问题.
我trycatch后的异常显示:
System.Data.OleDb.OleDbException:FROM子句语法错误.
atSystem.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32hr)
atSystem.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMSdbParams,Object&executeResult)
atSystem.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&executeResult)
atSystem.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehaviorbehavior,Object&executeResult)
atSystem.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehaviorbehavior,Stringmethod)
atSystem.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehaviorbehavior)
atSystem.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehaviorbehavior)
atSystem.Data.Common.DbDataAdapter.FillFromCommand(Objectdata,Int32startRecord,Int32maxRecords,StringsrcTable,IDbCommandcommand,CommandBehaviorbehavior)
atSystem.Data.Common.DbDataAdapter.Fill(DataSetdataSet,Int32startRecord,Int32maxRecords,StringsrcTable,IDbCommandcommand,CommandBehaviorbehavior)
atSystem.Data.Common.DbDataAdapter.Fill(DataSetdataSet)
邮箱:联系方式: