i m making website of college in which i have two show the all data of student(student name, course from student table, and faculity from teacher table and result ) after he login his account
i have 3 table in sql one is student which have student id, name and course etc.
,teacher which have course, faculity name etc.
and result which have student id, course and marks etc.
what the coding in asp.net to show the data. so that its show the data of particular student after login.
should i make a store procedure if yes how to compare it with username or sumthing else thx in advance
Hello, this is a question that is pretty general. In asp.net, you have to make a connection to the DB, execute your SQL commands, and display the results. All three of these steps have variations with regard to coding, especially the displaying part.
if you are also stuck on the authentication part, you can code the entire thing yourself or take advantage of some of the controls that are available. I assume you are using Visual Studio?
Take a look at Microsoft official site for asp.net, info regarding authentication:
i want to know how to match student id with username how to do that to show data general coding is select student.student_id,student.studentname,student.studentcourse, teacher.faculityname, teacher.course,result.marks from student,teacher,result where student.studentid=result.student.ic and student.course= faculity.course bt i want to know how to match student id with username plz provide me full coding as i m new to asp.net
The most obvious answer is that the user name is the student ID. If you don't want to do that and instead have a different login name then you will need another column in your student table that stores their user name.
Then you use the user name in the where clause of your SQL statement rather than their ID.
Your SQL statement is incorrect by the way. When joining tables you need to use the ON clause, this can't be done with the WHERE.
SELECT s.student_id,s.studentname,s.studentcourse, t.faculityname, t.course,result.marks from student as s,teacher as t,result ON s.studentid=result.student.ic and s.course= t.course WHERE --student ID or username --
I used the AS statement to give the tables aliases, its a bit easier to read. I also see there is a reference to linking to the faculity table but that is a typo and should be t (or teacher) I'm assuming.