How to get a row from the sqlitePCL database while refering to a particular item RRS feed

  • Question

  • I am making an online registration app for windows phone 8.1 and i wanted to get the details of a student but when i am using a particular field on the table to refer to.

    public StudentDetails GetStudentDetails(string studentNumber) { var dbconn = App.conn; StudentDetails student = null; using (var statement = dbconn.Prepare("SELECT StudentNumber,FirstName,SecondName,RegistrationNumber,HallName,Program,Faculty,YearOfStudy,Semester,CourseUnit FROM StudentDetails WHERE StudentNumber=?")) { statement.Bind(1, studentNumber); if(SQLiteResult.DONE == statement.Step()) { student = new StudentDetails() { StudentNumber = (string)statement[0], FirstName = (string)statement[1], SecondName = (string)statement[2], RegistrationNumber = (string)statement[3], HallName = (string)statement[4], Program = (string)statement[5], Faculty = (string)statement[6], YearOfStudy = (string)statement[7], Semester = (string)statement[8], CourseUnit = (string)statement[9] }; } } return student; }I have created a method in another class but it has my class name where I have listed the properties that are also on the table in my database.

    Thursday, July 21, 2016 1:54 PM