方法如下 参数是(1) select * from anlv_pro where pro_type='卧式机' and pro_name like '*11*'
(2)table1
public static DataSet ExecuteTextRet(string cmdText, string TableName)
{
DataSet ds = new DataSet();
OleDbDataAdapter adp = new OleDbDataAdapter();
OleDbCommand cmd = new OleDbCommand();
try
{
PrepareCommand(cmd, CommandType.Text, cmdText);
try
{
adp.SelectCommand = cmd;
adp.Fill(ds, TableName);
return ds;
}
catch (OleDbException e)
{
throw (new Exception(e.Message));
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
DisposeCmd(cmd);
} }
用的access 数据库中有数据~~~~
为什么我读不到??????
(2)table1
public static DataSet ExecuteTextRet(string cmdText, string TableName)
{
DataSet ds = new DataSet();
OleDbDataAdapter adp = new OleDbDataAdapter();
OleDbCommand cmd = new OleDbCommand();
try
{
PrepareCommand(cmd, CommandType.Text, cmdText);
try
{
adp.SelectCommand = cmd;
adp.Fill(ds, TableName);
return ds;
}
catch (OleDbException e)
{
throw (new Exception(e.Message));
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
DisposeCmd(cmd);
} }
用的access 数据库中有数据~~~~
为什么我读不到??????
pro_type= '卧式机 '
看看你Catch到什么错误没有
在access中也有数据~~~~
SELECT * from anlv_pro where pro_type='加工中心' and pro_name like '**'
在access中查询有数据~~~~
但是用这个方法却没有数据 ~~~~~~超郁闷
public static DataSet ExecuteTextRet(string cmdText, string TableName)
{
DataSet ds = new DataSet();
OleDbDataAdapter adp = new OleDbDataAdapter();
OleDbCommand cmd = new OleDbCommand();
try
{
PrepareCommand(cmd, CommandType.Text, cmdText);
try
{
adp.SelectCommand = cmd;
adp.Fill(ds, TableName);
return ds;
}
catch (OleDbException e)
{
throw (new Exception(e.Message));
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
DisposeCmd(cmd);
} }
在access 中查询要用SELECT * from anlv_pro where pro_type= '加工中心 ' and pro_name like '*工地*'
但是在.net中还要用SELECT * from anlv_pro where pro_type= '加工中心 ' and pro_name like '%工地% '