使用C#在Access和SQL Server中构建模糊查询语句,类似(以Access为例): System.Data.OleDb.OleDbCommand oledbCmd = null;
System.Data.OleDb.OleDbDataReader oledbReader = null;
System.Data.OleDb.OleDbConnection oledbConn = null;
成功建立数据库连接之后,构造查询
string strSql = "select * from StaticAudit where cKey_1 Like '*Demo*'";
oledbCmd = oledbConn.CreateCommand();
oledbCmd.CommandText = strSql;
oledbCmd.CommandType=CommandType.Text;
oledbReader = oledbCmd.ExecuteReader();
读取数据得时候没有数据啊,在Access和SQLServer中执行查询可以获取数据,用程序获取不了,谢谢啊,有分
System.Data.OleDb.OleDbDataReader oledbReader = null;
System.Data.OleDb.OleDbConnection oledbConn = null;
成功建立数据库连接之后,构造查询
string strSql = "select * from StaticAudit where cKey_1 Like '*Demo*'";
oledbCmd = oledbConn.CreateCommand();
oledbCmd.CommandText = strSql;
oledbCmd.CommandType=CommandType.Text;
oledbReader = oledbCmd.ExecuteReader();
读取数据得时候没有数据啊,在Access和SQLServer中执行查询可以获取数据,用程序获取不了,谢谢啊,有分
string strSql = String.Format("select * from StaticAudit where cKey_1 Like '%{0}%'",temp);
string strSql = "select * from StaticAudit where cKey_1 Like '%"&Demo&"%'";
http://community.csdn.net/Expert/TopicView3.asp?id=4724403,
我觉得应该是系统原因,估计得读到内存中再进行过滤了。