zoukankan      html  css  js  c++  java
  • ActiveRecord多表查询

    当from中有多个表时,而select 中只需要一个表中的所有数据,不必像sql一样用*,只要把类名写出来就行,摸索出来的经验,记下,希望对大家有帮助.

    见下面查询,特别是加红部分.

           [DataObjectMethod(DataObjectMethodType.Select)]
            public static ZjcXueshenghuojiang[] List(int xuenian, int xueqi,long banjiId,long banjiStudentId)
            {
                //BaseBanjiStudent stu = new BaseBanjiStudent();
                //stu.BanjiStudentid

                string strHql = @"Select huojiang from ZjcXueshenghuojiang huojiang , BaseBanjiStudent stu ";
                strHql += " where huojiang.Xuenian = :xuenian and huojiang.Xueqi = :xueqi ";
                strHql += " and  huojiang.BanjiStudentId = stu.BanjiStudentid  and stu.BaseBanji.Banjiid = :banjiId ";
                //    strHql += " order by huojiang.StartDate DESC ";
                SimpleQuery query = new SimpleQuery(
                    typeof(ZjcXueshenghuojiang), strHql);
                query.SetParameter("xuenian", xuenian);
                query.SetParameter("xueqi", xueqi);
                query.SetParameter("banjiId", banjiId);
                return (ZjcXueshenghuojiang[])ExecuteQuery(query);
            }

  • 相关阅读:
    安卓7.0手机拍照闪退问题解决
    自定义字体TextView
    Android Studio中的CmakeList NDK配置
    动态规划之最长公共子序列(LCS)
    快速排序
    KMP算法实现
    数据结构中的栈
    双向链式线性表(模板实现)
    Android Studio配置OpenCV(非NDK)
    AndroidStudio 1.4配置NDK
  • 原文地址:https://www.cnblogs.com/shiningrise/p/1037526.html
Copyright © 2011-2022 走看看