当前位置: 首页>>代码示例>>C#>>正文


C# DBConnection.getResultsList方法代码示例

本文整理汇总了C#中DBConnection.getResultsList方法的典型用法代码示例。如果您正苦于以下问题:C# DBConnection.getResultsList方法的具体用法?C# DBConnection.getResultsList怎么用?C# DBConnection.getResultsList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBConnection的用法示例。


在下文中一共展示了DBConnection.getResultsList方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: checkAvailability

    // function to check if the username already exists.
    // return 1 if username is available
    public int checkAvailability(String username, String email)
    {
        List<String> myList1 = new List<string>();
        List<String> myList2 = new List<string>();

        DBConnection myConnection = new DBConnection();
        myConnection.connect("LILY-PC", "projectdb1", "admin", "123");
        String query1 = String.Format("SELECT * FROM UserAcc WHERE u_name = '{0}'", username);
        String query2 = String.Format("SELECT email FROM Candidate WHERE email = '{0}'", email);

        myList1 = myConnection.getResultsList(query1, "u_name");
        myList2 = myConnection.getResultsList(query2, "email");

        if ((myList1.Count >= 1) || (myList2.Count >= 1)) { return 0; }
        else { return 1; }
    }
开发者ID:lilylakshi,项目名称:second-year-group-project,代码行数:18,代码来源:LoginModule.cs

示例2: getListOfForums

 public List<String> getListOfForums()
 {
     DBConnection myConnection = new DBConnection();
     myConnection.connect("LILY-PC", "projectdb1", "admin", "123");
     String query = "SELECT f_title FROM [projectdb1].[dbo].[Forum]";
     return myConnection.getResultsList(query, "f_title");
 }
开发者ID:lilylakshi,项目名称:second-year-group-project,代码行数:7,代码来源:ForumModule.cs

示例3: getForumID

 public String getForumID(String forumName)
 {
     List<String> myList = new List<string>();
     DBConnection myConnection = new DBConnection();
     myConnection.connect("LILY-PC", "projectdb1", "admin", "123");
     String query = String.Format("SELECT f_id FROM [projectdb1].[dbo].[Forum] WHERE f_title = '{0}'", forumName);
     myList = myConnection.getResultsList(query, "f_id");
     return myList.First();
 }
开发者ID:lilylakshi,项目名称:second-year-group-project,代码行数:9,代码来源:ForumModule.cs

示例4: checkPassword

 // functionto check the password for a given username
 public int checkPassword(String username, String password)
 {
     List<String> myList1 = new List<string>();
     List<String> myList2 = new List<string>();
     DBConnection myConnection = new DBConnection();
     myConnection.connect("LILY-PC", "projectdb1", "admin", "123");
     String query = String.Format("SELECT * FROM UserAcc WHERE u_name='{0}'", username);
     myList1 = myConnection.getResultsList(query, "u_name");
     myList2 = myConnection.getResultsList(query, "passd");
     String[] array1 = myList1.ToArray();
     String[] array2 = myList2.ToArray();
     for (int i = 0; i < array1.Length; i++ )
     {
         if (array1[i]==username && array2[i]==password) { return 1; }
     }
     return 0;
 }
开发者ID:lilylakshi,项目名称:second-year-group-project,代码行数:18,代码来源:LoginModule.cs

示例5: getUsername

 public String getUsername()
 {
     String userId = (String)HttpContext.Current.Session["userID"];
     DBConnection myConnection = new DBConnection();
     myConnection.connect("LILY-PC", "projectdb1", "admin", "123");
     String query = String.Format("SELECT u_name FROM UserAcc WHERE u_id='{0}'", userId);
     return myConnection.getResultsList(query, "u_name").ElementAt(0);
 }
开发者ID:lilylakshi,项目名称:second-year-group-project,代码行数:8,代码来源:LoginModule.cs

示例6: getID

 public String getID(String username)
 {
     String id; List<String> myList = new List<string>();
     DBConnection myConnection = new DBConnection();
     myConnection.connect("LILY-PC", "projectdb1", "admin", "123");
     String query = String.Format("SELECT * FROM UserAcc WHERE u_name='{0}'", username);
     myList = myConnection.getResultsList(query, "u_id");
     String[] array = myList.ToArray();
     id = array[0];
     return id;
 }
开发者ID:lilylakshi,项目名称:second-year-group-project,代码行数:11,代码来源:LoginModule.cs

示例7: getFirstName

 public String getFirstName(String userId)
 {
     List<String> myList = new List<string>();
     DBConnection myConnection = new DBConnection();
     myConnection.connect("LILY-PC", "projectdb1", "admin", "123");
     String query = String.Format("SELECT f_name FROM Candidate WHERE u_id='{0}'", userId);
     myList = myConnection.getResultsList(query, "f_name");
     if (myList.Count == 0)
     {
         return this.getUsername();
     }
     return myList.ElementAt(0);
 }
开发者ID:lilylakshi,项目名称:second-year-group-project,代码行数:13,代码来源:LoginModule.cs


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