免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1769 | 回复: 0
打印 上一主题 下一主题

弱弱的问一下 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-10-08 10:11 |只看该作者 |倒序浏览
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表的模式进行数据填充吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP