access模糊查询 (急急急)
帮帮吧:
string Keyword = txtKeyword.Text.Trim().ToString();
string strSql = "select * from etw_product where p_name like '% " + Keyword + "% ' ";
//string strSql = "select * from etw_product where p_name like '%水晶瑪瑙% ' ";(这句也报错)
OleDbConnection cn = new OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings[ "xkConnStr "].ConnectionString);
OleDbDataAdapter cmd = new OleDbDataAdapter(strSql,cn);
cmd.SelectCommand.Parameters.Add( "? ", OleDbType.VarChar).Value = Keyword;
DataSet ds = new DataSet();
cn.Open();
cmd.Fill(ds);
cn.Close();
dtdproduct.DataSource = ds;
dtdproduct.DataBind();
运行:
异常详细信息:
System.Data.OleDb.OleDbException: 内存溢出
源错误:
行 39: DataSet ds = new DataSet();
行 40: cn.Open();
行 41: cmd.Fill(ds);
行 42: cn.Close();
行 43:
源文件: f:\孙金\csj-china\index.aspx.cs 行: 41
堆栈跟踪:
[OleDbException (0x80004005): 内存溢出]
System.Data.OleDb.OleDbDataReader.ProcessResults(OleDbHResult hr) +47
System.Data.OleDb.OleDbDataReader.GetRowHandles() +234
System.Data.OleDb.OleDbDataReader.ReadRowset() +38
System.Data.OleDb.OleDbDataReader.Read() +174
System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping) +176
System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) +176
System.Data.Common.DataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader