Fiction
Legacy Member
Ik heb een probleemje met een inlogsysteem dat ik ontworpen heb in ASP.NET. Dus het inlogsysteem kijkt de velden txtLogin en txtPassword na of de ingevoerde waardes in de SQL database staan. Dit werkt als ik het rode gedeelte weglaat. Maar wanneer ik het rode gedeelte er bijvoeg (dit gaat dus de 'instelling' zoeken die bij deze login hoort en stopt dit in een session) geeft hij de volgende fout (op het SQL statement waarschijnlijk).
http://1891.sin.khk.be/error.JPG
Mij lijkt het SQL statement correct, dus ik zie het probleem verder niet
http://1891.sin.khk.be/error.JPG
Code:
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script language="VB" runat="server">
Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim intCount As Integer
Dim strSQL As String
Dim strSQLInstelling As String
Dim myCommand2 As SqlCommand
Dim strTest As Integer
myConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("DB_WAINOTConnectionString").ToString())
myConnection.Open()
strSQL = "SELECT COUNT(*) FROM tblBegeleiders " _
& "WHERE BegeleiderLoginID='" & Replace(txtLogin.Text, "'", "''") & "' " _
& "AND BegeleiderPaswoord='" & Replace(txtPassword.Text, "'", "''") & "';"
lblTest.Text = strSQL
myCommand = New SqlCommand(strSQL, myConnection)
intCount = myCommand.ExecuteScalar
'lblTest.Text = intCount
If (intCount > 0) Then
[COLOR="Red"]
strSQLInstelling = "SELECT InstellingNaam" _
& "TblBegeleiders INNER JOIN TblInstellingen ON TblBegeleiders.InstellingID = TblInstellingen.InstellingID" _
& "WHERE BegeleiderLoginID='" & Replace(txtLogin.Text, "'", "''") & "' " _
& "AND BegeleiderPaswoord='" & Replace(txtPassword.Text, "'", "''") & "';"
myCommand2 = New SqlCommand(strSQLInstelling, myConnection)
strTest = myCommand2.ExecuteScalar
Session("Login") = 1
Session("Instelling") = strTest
[/COLOR]
Response.Redirect("Ingelogd.aspx")
Else
lblError.Visible = True
End If
myConnection.Close()
End Sub
Mij lijkt het SQL statement correct, dus ik zie het probleem verder niet

