SQL语句在access中有返回值 但是在asp.net中无返回值
SQL语句如下:select ProductId,ProductName,ProductImage,ProductNo,ProductMade,ProductIntor,ProductTypeId,addTime FROM ProductInfo where ProductName like '*电器*' or ProductIntor like '*电器*'
然后这条SQL语句放到access中运行,是有返回数据的。
但是当我用asp.net运行的时候 却死活得不到数据。
代码如下:
public static DataSet Query(string SQLString)
{
using (OleDbConnection connection = new OleDbConnection(connectionString))
{
DataSet ds = new DataSet();
try
{
connection.Open();
OleDbDataAdapter command = new OleDbDataAdapter(SQLString, connection);
command.Fill(ds, "ds");
}
catch (System.Data.OleDb.OleDbException ex)
{
throw new Exception(ex.Message);
}
return ds;
}
}
SQLString = select ProductId,ProductName,ProductImage,ProductNo,ProductMade,ProductIntor,ProductTypeId,addTime FROM ProductInfo where ProductName like '*电器*' or ProductIntor like '*电器*'
connectionString = Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\工作\上海斯加\SJa\SJaWeb\App_Data\SJaDB.mdb;Persist Security Info=False
access是2003的版本 VS是2008
会不会是因为ado.net版本不正确所导致的得不到查询结果呢 --------------------编程问答-------------------- 求助啊。。各位大侠~!~~~!~!~~ --------------------编程问答-------------------- SQL还是存在些许差异的,把“*电器*”换成“%电器%”看看。
--------------------编程问答--------------------
我就是用% 换成了 *的。。。因为access和sql的通配符不一样,access不认识% 只认识 *。。。
我觉得我好悲剧啊。。。
补充:.NET技术 , ASP.NET