• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# DAL.ClassConnectDB类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DAL.ClassConnectDB的典型用法代码示例。如果您正苦于以下问题:C# ClassConnectDB类的具体用法?C# ClassConnectDB怎么用?C# ClassConnectDB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ClassConnectDB类属于DAL命名空间,在下文中一共展示了ClassConnectDB类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: checkForgotPassword

        public static Entity.Employee checkForgotPassword(string username, string email)
        {

            try
            {
                string sqlforgot = "  SELECT * FROM Employee WHERE [email protected] AND [email protected]";
                string Addvalue = "@user,@email";
                string value = username + "," + email;

                Entity.Employee empCheck = new Entity.Employee();

                ClassConnectDB conn = new ClassConnectDB();
                SqlDataReader readCheckRole = conn.SelectWhereSqlDataReader(sqlforgot, Addvalue, value);
                //SqlDataReader readCheckRole = conn.SelectSqlDataReader(sqlforgot);
                if (readCheckRole.Read())
                {
                    empCheck.Emp_FName = readCheckRole["Emp_FName"].ToString();
                    empCheck.Emp_LName = readCheckRole["Emp_LName"].ToString();
                    empCheck.Emp_username = readCheckRole["Emp_username"].ToString();
                    empCheck.Emp_password = readCheckRole["Emp_password"].ToString();
                    empCheck.Emp_Email = readCheckRole["Emp_Email"].ToString();
                }
                conn.Close();
                return empCheck;

            }
            catch (Exception)
            {

                return null;
            }

        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:33,代码来源:Employee.cs


示例2: selectCuriID

        public static string selectCuriID(string curYear, string curCourse, string curGroup)
        {
                    ClassConnectDB con=new ClassConnectDB();
            string reid="";
            try
            {
            string [email protected]"SELECT Curri_Id
                                FROM Curriculum Where [email protected] AND [email protected] AND [email protected]";
            string Addvalue="@year,@co,@group";
            string value=curYear+","+curCourse+","+curGroup;
           SqlDataReader dr= con.SelectWhereSqlDataReader(sqlSelect,Addvalue,value);
           if (dr.Read())
           {
               reid = dr["Curri_Id"].ToString();
           }


            return reid;

            }
            catch (Exception)
            {

                return "";
            }
            con.Close();
            
        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:28,代码来源:Curriculum.cs


示例3: insertDetailTeachAfter

        public static bool insertDetailTeachAfter(string year, string level, string term, string group, string subject, string userid)
        {
            ClassConnectDB conn = new ClassConnectDB();

            string sqlcheckvalue = "SELECT  DetailTech_ID FROM  DetailTech WHERE [email protected] and [email protected] and DetailTeach_Year [email protected] and [email protected] and  [email protected]";
            string addvaluecheck = "@level,@class,@year,@term,@code";
            string valuecheck = level + "," + group + "," + year + "," + term + "," + subject;
            SqlDataReader drrcheck = conn.SelectWhereSqlDataReader(sqlcheckvalue, addvaluecheck, valuecheck);
            if (!drrcheck.HasRows)
            {
                string sql = @"INSERT INTO DetailTech
                      (DetailTech_Level, DetailTech_Class, DetailTeach_Year, DetailTech_Term, StructSub_Code, Create_user, CreateDate)
                        VALUES(@level,@class,@year,@term,@code,@user,getDate())";

                string addvalue = "@level,@class,@year,@term,@code,@user";
                string value = level + "," + group + "," + year + "," + term + "," + subject + "," + userid;
                bool insert = conn.InsertValue(sql, addvalue, value);
                conn.Close();
                if (insert) { return true; }
                else { return false; }
            }
            else
            {
                return false;
            }
        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:26,代码来源:DetailTeach.cs


示例4: getCommentForPost

        public static DataTable getCommentForPost(int thePost)
        {
            try
                {
                    string sql = @"SELECT   TOP 1  [KmComPost_ID]
                                  ,[KmPost_ID]
                                  ,[ComPost_Detail]
                                  ,REPLACE(CONVERT(VARCHAR(11), Create_date, 106), ' ', '-') AS datepostkm
                                  ,CONVERT(VARCHAR(12),Create_time ,114) as timepostkm
                                  ,[Create_user_id]
								  ,[Create_user_type]
                                  FROM KmCommentPost where KmPost_ID='" + thePost + "'order by [Create_date]  asc ";

                    ClassConnectDB conn = new ClassConnectDB();
                    SqlDataReader drr = conn.SelectSqlDataReader(sql);
                    DataTable dt = new DataTable();
                    dt.Load(drr);

                    conn.Close();
                    return dt;
                }
                catch (Exception)
                {
                    return null;
                }


        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:28,代码来源:Knowledge.cs


示例5: checkCredit

        public static int checkCredit(string year, string level, string term, string group)
        {
            try
            {
                /****************************
                 * function ตรวจสอบหน่วยกิตทั้งหมด
                 *
                 * **************************/
                int creditAll = 0;
                ClassConnectDB conn = new ClassConnectDB();
                string sql = @"SELECT sum (CONVERT(int,(SUBSTRING([StructSub_Credit], 1 , 1 )) ))as credit
                          FROM [WEBCSDB].[dbo].[StructSubject]
                          where StructSub_Code in (
                          SELECT TOP 1000 [StructSub_Code]
                          FROM  [DetailTech]
                          where [DetailTech_Level]='" + level + "' and [DetailTech_Class]='" + group + "' and [DetailTeach_Year]='" + year + "' and [DetailTech_Term]='" + term + "' )";

                SqlDataReader drr = conn.SelectSqlDataReader(sql);
                if (drr.Read())
                {
                    creditAll = Convert.ToInt32(drr["credit"].ToString());
                }
                return creditAll;
            }
            catch (Exception)
            {
                return 0;
            }
        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:29,代码来源:DetailTeach.cs


示例6: insertSubject

        public static bool insertSubject(Entity.CurriculumInfo subject)
        {
            
             subcode=subject.StructSub_Code.ToString();
            subNameTha=subject.StructSub_NameTha.ToString();
            subNameEn=subject.StructSub_NameEn.ToString();
             detail=subject.StructSub_Detail.ToString();
            subCre=subject.StructSub_Credit.ToString();
            curID=subject.Curri_Id.ToString();

            ClassConnectDB conn = new ClassConnectDB();
            //conn.TransStart();
            try
            {

                string insertSubject = "INSERT INTO StructSubject(StructSub_Code, StructSub_NameTha, StructSub_NameEn, StructSub_Detail, StructSub_Credit, Curri_Id)VALUES(@code,@nameTha,@nameEn,@detail,@struCre,@curiID)";
                string AddvalueSubject = "@code,@nameTha,@nameEn,@detail,@struCre,@curiID";
                string value = subcode + "," + subNameTha + "," + subNameEn + "," + detail + "," + subCre + "," + curID;
                conn.InsertValue(insertSubject,AddvalueSubject,value);

                return true;

            }
            catch (Exception)
            {
                return true;
            }
            conn.Close();

            
        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:31,代码来源:Curriculum.cs


示例7: checkForgotPassword

        public static Entity.Teacher checkForgotPassword(string username, string email)
        {
            try
            {
                string sqlforgot = "  SELECT * FROM Teacher WHERE [email protected] AND [email protected]";
                string Addvalue = "@user,@email";
                string value = username + "," + email;

                Entity.Teacher tchCheck = new Entity.Teacher();

                ClassConnectDB conn = new ClassConnectDB();
                SqlDataReader readCheckRole = conn.SelectWhereSqlDataReader(sqlforgot, Addvalue, value);
                //SqlDataReader readCheckRole = conn.SelectSqlDataReader(sqlforgot);
                if (readCheckRole.Read())
                {
                    tchCheck.Tch_FName = readCheckRole["Tch_FName"].ToString();
                    tchCheck.Tch_LName = readCheckRole["Tch_LName"].ToString();
                    tchCheck.Tch_username = readCheckRole["Tch_username"].ToString();
                    tchCheck.Tch_password = readCheckRole["Tch_password"].ToString();
                    tchCheck.Tch_email = readCheckRole["Tch_email"].ToString();
                }
                conn.Close();
                return tchCheck;

            }
            catch (Exception)
            {

                return null;
            }
        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:31,代码来源:Teacher.cs


示例8: checkForgotPassword

        public static Entity.Student checkForgotPassword(string username, string email)
        {
            try
            {
                string sqlforgot = "  SELECT * FROM Student WHERE [email protected] AND [email protected]";
                string Addvalue = "@user,@email";
                string value = username + "," + email;

                Entity.Student stdCheck = new Entity.Student();

                ClassConnectDB conn = new ClassConnectDB();
                SqlDataReader readCheckRole = conn.SelectWhereSqlDataReader(sqlforgot, Addvalue, value);
                //SqlDataReader readCheckRole = conn.SelectSqlDataReader(sqlforgot);
                if (readCheckRole.Read())
                {
                    stdCheck.Std_FName = readCheckRole["Std_FName"].ToString();
                    stdCheck.Std_LName = readCheckRole["Std_LName"].ToString();
                    stdCheck.Std_Username = readCheckRole["Std_Username"].ToString();
                    stdCheck.Std_Password = readCheckRole["Std_Password"].ToString();
                    stdCheck.Std_email = readCheckRole["Std_email"].ToString();
                }
                conn.Close();
                return stdCheck;

            }
            catch (Exception)
            {

                return null;
            }
        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:31,代码来源:Student.cs


示例9: deleteDetailTeach

 public static bool deleteDetailTeach(string dchID)
 {
     ClassConnectDB conn = new ClassConnectDB();
     string sql = "DELETE FROM DetailTech WHERE DetailTech_ID='" + dchID + "'";
     bool del = conn.QueryExecuteNonQuery(sql);
     conn.Close();
     return del;
 }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:8,代码来源:DetailTeach.cs


示例10: selectTestCode

 public static DataTable selectTestCode()
 {
     ClassConnectDB conn = new ClassConnectDB();
     string sql = "  SELECT *  FROM [WEBCSDB].[dbo].[Teacher] ";
     SqlDataReader drr = conn.SelectSqlDataReader(sql);
     DataTable dt = new DataTable();
     dt.Load(drr);
     return dt;
 }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:9,代码来源:DetailTeach.cs


示例11: manateYear

        public static System.Data.DataTable manateYear()
        {
            string sql = "select YEAR(getdate())+542 as passYear,YEAR(getdate())+543 as curYear,YEAR(getdate())+544 as fuYear";

            ClassConnectDB conn = new ClassConnectDB();
            SqlDataReader drr = conn.SelectSqlDataReader(sql);
            DataTable dt = new DataTable();
            dt.Load(drr);
            return dt;
           
        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:11,代码来源:ManageDate.cs


示例12: showSubject

 public static DataTable showSubject(string code)
 {
     try
     {
         string sql = "SELECT  *  FROM StructSubject Where StructSub_Code='" + code + "'";
         ClassConnectDB conn = new ClassConnectDB();
         SqlDataReader dr = conn.SelectSqlDataReader(sql);
         DataTable dt = new DataTable();
         dt.Load(dr);
         return dt;
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
         throw;
         // return null;
     }
 }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:18,代码来源:PlanEducate.cs


示例13: insertGetcoment

 public static DataTable insertGetcoment(int clickPostID)
 {
     ClassConnectDB conn = new ClassConnectDB();
     string sql = @" SELECT   [ComPost_ID]
                       ,[Post_ID]
                       ,[ComPost_Detail]
                       ,[Create_date]
                       ,[Create_time]
                       ,[Create_user_id]
                       ,[Create_user_type]
                     FROM [CommentPost]
                     where Post_ID = " + clickPostID + " ORDER BY Create_date asc ,  Create_time asc";
     SqlDataReader drr = conn.SelectSqlDataReader(sql);
     DataTable dt = new DataTable();
     dt.Load(drr);
     conn.Close();
     return dt;
 }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:18,代码来源:mainManage.cs


示例14: checkRoleLogin

        public static Entity.Student checkRoleLogin(string username, string password)
        {
            try
            {
                Entity.Student stdlog = new Entity.Student();

                string sqlchekRole = " SELECT * FROM Student WHERE (Std_Username = @user) AND (Std_Password = @pass)";
                string Addvalue = "@user,@pass";
                string value = username + "," + password;

                ClassConnectDB conn = new ClassConnectDB();
                SqlDataReader readCheckRole = conn.SelectWhereSqlDataReader(sqlchekRole, Addvalue, value);
                if (readCheckRole.Read())
                {

                    stdlog.Std_Type = readCheckRole["Std_Type"].ToString();
                    stdlog.Std_FName = readCheckRole["Std_FName"].ToString();
                    stdlog.Std_LName = readCheckRole["Std_LName"].ToString();
                    stdlog.Std_Campus_Code = readCheckRole["Std_Campus_Code"].ToString();
                    stdlog.Std_YearEducate = readCheckRole["Std_YearEducate"].ToString();
                    stdlog.Std_Username = readCheckRole["Std_Username"].ToString();
                    stdlog.Std_Password = readCheckRole["Std_Password"].ToString();
                    stdlog.std_picturepath = readCheckRole["Std_picturepath"].ToString();
                }

                string iplog = Common.network.showIp();
                string logdate = "CONVERT(VARCHAR(10), GETDATE(), 104)";
                string logtime = "CONVERT(VARCHAR(8), GETDATE(), 108)";
                string tid = readCheckRole["Std_Campus_Code"].ToString();
                string insertLog = "INSERT INTO LogLogInStd(Log_IP, Log_Date, Log_timeStart, Std_Campus_Code) VALUES('" + iplog + "'," + logdate + "," + logtime + "," + tid + ")";
                conn.QueryExecuteNonQuery(insertLog);


                conn.Close();
                return stdlog;


            }
            catch (Exception)
            {

                return null;
            }
        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:44,代码来源:Student.cs


示例15: checkRoleLogin

        public static Entity.Teacher checkRoleLogin(string username, string password)
        {
            Entity.Teacher tch = new Entity.Teacher();
            try
            {
                string sqlchekRole = "  SELECT * FROM Teacher WHERE   [email protected] AND [email protected]";
                string Addvalue = "@user,@pass";
                string value = username + "," + password;

                ClassConnectDB conn = new ClassConnectDB();
                SqlDataReader readCheckRole = conn.SelectWhereSqlDataReader(sqlchekRole, Addvalue, value);
                if (readCheckRole.Read())
                {
                    tch.Tch_ID = readCheckRole["Tch_ID"].ToString();
                    tch.Tch_Type = readCheckRole["Tch_Type"].ToString();
                    tch.Tch_FName = readCheckRole["Tch_FName"].ToString();
                    tch.Tch_LName = readCheckRole["Tch_LName"].ToString();
                    tch.Tch_username = readCheckRole["Tch_username"].ToString();
                    tch.Tch_password = readCheckRole["Tch_password"].ToString();
                    tch.Tch_picturepath = readCheckRole["Tch_picturepath"].ToString();

                }

                string iplog = Common.network.showIp();
                string logdate = "CONVERT(VARCHAR(10), GETDATE(), 104)";
                string logtime = "CONVERT(VARCHAR(8), GETDATE(), 108)";
                string tid = readCheckRole["Tch_ID"].ToString();
                string insertLog = "INSERT INTO LogLoginTeach(Log_IP, Log_Date, Log_timeStart, Tch_ID) VALUES('" + iplog + "'," + logdate + "," + logtime + "," + tid + ")";
                conn.QueryExecuteNonQuery(insertLog);
                conn.Close();

                return tch;



            }
            catch (Exception)
            {

                return null;
            }

        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:43,代码来源:Teacher.cs


示例16: checkRoleLogin

        public static Entity.Employee checkRoleLogin(string username, string password)
        {

            try
            {
                Entity.Employee emp = new Entity.Employee();

                string sqlchekRole = "  SELECT * FROM Employee WHERE [email protected] AND [email protected]";
                string Addvalue = "@user,@pass";
                string value = username + "," + password;

                ClassConnectDB conn = new ClassConnectDB();
                SqlDataReader readCheckRole = conn.SelectWhereSqlDataReader(sqlchekRole, Addvalue, value);
                if (readCheckRole.Read())
                {
                    emp.Emp_ID = readCheckRole["Emp_ID"].ToString();
                    emp.Emp_Type = readCheckRole["Emp_Type"].ToString();
                    emp.Emp_LName = readCheckRole["Emp_LName"].ToString();
                    emp.Emp_FName = readCheckRole["Emp_FName"].ToString();
                    emp.Emp_username=readCheckRole["Emp_username"].ToString();
                    emp.Emp_password = readCheckRole["Emp_password"].ToString();
                }

                string iplog = Common.network.showIp();
                string logdate = "CONVERT(VARCHAR(10), GETDATE(), 104)";
                string logtime = "CONVERT(VARCHAR(8), GETDATE(), 108)";
                string tid = readCheckRole["Emp_ID"].ToString();
                string insertLog = "INSERT INTO LogLoginEmp(Log_IP, Log_Date, Log_timeStart, Emp_id) VALUES('" + iplog + "'," + logdate + "," + logtime + "," + tid + ")";
                conn.QueryExecuteNonQuery(insertLog);
             

                conn.Close();
                return emp;


            }
            catch (Exception)
            {

                return null;
            }
        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:42,代码来源:Employee.cs


示例17: selectShowAllPlanTree

        public static System.Data.DataTable selectShowAllPlanTree(string yearCurriEdu)
        {
            DataTable dt = new DataTable();
            try
            {
                string sql = @"SELECT     ShowPlanEducate.ShowPlan_Year, ShowPlanEducate.ShowPlan_Semester, ShowPlanEducate.StructSub_Code, StructSubject.StructSub_NameTha
                                    FROM  ShowPlanEducate INNER JOIN
                                     StructSubject ON ShowPlanEducate.StructSub_Code = StructSubject.StructSub_Code
                                    where ShowPlanEducate.showplan_yearupdate='" + yearCurriEdu + "'";

                ClassConnectDB conn = new ClassConnectDB();
                SqlDataReader drr = conn.SelectSqlDataReader(sql);
                dt.Load(drr);

                return dt;
            }
            catch (Exception)
            {
                return null;
            }
        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:21,代码来源:PlanEducate.cs


示例18: selectShowNameSubjectPass

        public static string selectShowNameSubjectPass(string folloSubject)
        {
            string name;
            ClassConnectDB conn = new ClassConnectDB();
            try
            {
                string sql="SELECT StructSub_NameTha FROM StructSubject WHERE StructSub_Code='"+folloSubject+"'";
               SqlDataReader drr= conn.SelectSqlDataReader(sql);
               if (drr.Read()) {
                   name = drr["StructSub_NameTha"].ToString();
                   return name;
               }
               else
                   return null ;
            }
            catch (Exception)
            {
                return null;
            }


        }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:22,代码来源:Curriculum.cs


示例19: selectCuriYear

 public static string selectCuriYear(string yearedu)
 {
     string year = "";
     try
     {
         string sql = @"SELECT max( [Curri_Year]) as yearEducate
                       FROM [Curriculum]
                       where  curri_year <= '" + yearedu + "' ";
         ClassConnectDB conn = new ClassConnectDB();
         SqlDataReader drr = conn.SelectSqlDataReader(sql);
         if (drr.Read())
         {
             year = drr["yearEducate"].ToString();
         }
         conn.Close();
         return year;
     }
     catch (Exception)
     {
         return null;
     }
 }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:22,代码来源:PlanEducate.cs


示例20: selectUserPost

 public static System.Data.DataTable selectUserPost(string userid)
 {
     try
     {
         ClassConnectDB conn = new ClassConnectDB();
         string sql = @"SELECT  [Post_ID]
                   ,[Post_Detail]
                   ,[Create_date]
                   ,[Create_time]
                   ,[Create_user_id]
                   ,[Create_user_type]
               FROM [Post]
               where Create_user_id = '" + userid + "'  ORDER BY Create_date desc ,  Create_time desc ";
         SqlDataReader drr = conn.SelectSqlDataReader(sql);
         DataTable dt = new DataTable();
         dt.Load(drr);
         conn.Close();
         return dt;
     }
     catch (Exception ex) {
         return null;
     }
 }
开发者ID:AppCPC,项目名称:WebComSci,代码行数:23,代码来源:mainManage.cs



注:本文中的DAL.ClassConnectDB类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DAL.ConexionDb类代码示例发布时间:2022-05-24
下一篇:
C# D3TypeDescriptor.FieldDescriptor类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap