hello i'm using asp.net 2 with
VB, i have a little problem i have a users table and a marks table for students now each parent in the users table has a child and he wants to see his child's marks in the subjects his child take, i'm using the aspnetdb and its users table i have that code but it's not working :
Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
If Page.IsPostBack = False Then
binddata()
End If
End Sub
Sub binddata()
Dim myuser As String = Context.User.Identity.Name
Dim con As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\aspnetdb.mdf;Integrated Security=True;User Instance=True"
Dim sq As String = "SELECT dbo.grades.serial, dbo.grades.stage, dbo.grades.class, dbo.grades.subject, dbo.grades.marks FROM dbo.grades INNER JOIN dbo.aspnet_Users ON dbo.grades.serial = dbo.aspnet_Users.serial WHERE dbo.aspnet_Users.serial = " & myuser
Dim conn As SqlConnection = New SqlConnection(con)
Dim com As SqlCommand = New SqlCommand(sq, conn)
Try
conn.Open()
Dim rdr As SqlDataReader = com.ExecuteReader()
Me.dl1.DataSource = rdr
Me.dl1.DataBind()
Catch ex As Exception
Response.Write("error in yor query")
conn.Close()
End Try
End Sub
so hope u guys can help me in this problem.thanks in advance