- 论坛徽章:
- 0
|
public DataSet QueryStandard(string sID, string sName, string sType, string sKeyWords, string sVersion, string sSign)
{
OdbcDataAdapter theAdapter = new OdbcDataAdapter();
DataSet data = new DataSet();
try
{
string strSQL = "";
strSQL = @"select distinct a.* from Standard a left join Standard_Type b on a.oid=b.oid where 1=1";
if (sID != "") strSQL = strSQL + " and a.StandardNo ='" + sID + "'";
if (sName != "") strSQL = strSQL + " and a.StandardName ='" + sName + "'";
if (sType != "") strSQL = strSQL + " and substr(b.StandardCNo,1," + sType.Length + ") ='" + sType + "'";
if (sKeyWords != "") strSQL = strSQL + " and a.KeyWords like '%" + sKeyWords + "%'";
if (sVersion != "") strSQL = strSQL + " and a.Version ='" + sVersion + "'";
if (sSign != "") strSQL = strSQL + " and a.Sign ='" + sSign + "'";
OdbcCommand commandDtl3 = new OdbcCommand(strSQL, conn);
theAdapter.SelectCommand = commandDtl3;
theAdapter.Fill(data, "Standard");
}
catch (System.Exception e)
{
throw e;
}
finally
{
theAdapter.Dispose();
theAdapter = null;
}
return data;
}
别人做的东西,我拿来学习,可只能看个大概,有人帮忙指点下吗?
里面的a(b)我不知道是什么?找定义说是string从元数据,也没找出什么名堂。
还有OdbcCommand(strSQL, conn)这个函数是系统自带的吗?从此处功能上来说是需要根据strSQL过滤数据的,找定义也没找到。
最后一行theAdapter.Fill(data, "Standard")按他程序的意思是吧查询来的数据放在data中,那第2个参数干什么用的,数据查询过程在Standard中进行。意思是data中要以Standard表的模式进行数据填充吗? |
|