이 코드가 작동하지 않는 이유는 확실하지 않습니다 나는 테이블 필드 데이터에 따라 수행했으며 아직 SQL Datareader를 가져올 수 없습니다. 작업. 테이블과 모든 데이터 필드를 검사했는데 모든 것이 정확합니다. 하지만 여전히 데이터베이스에서 데이터를 읽을 수 없습니다. 도움말 T.Tasp.net.vb 데이터가 없을 때 읽지 시도가 잘못되었습니다.
Dim connectionString = ConfigurationManager.ConnectionStrings("CleanOneConnectionString").ConnectionString
Dim myConn As New SqlConnection(connectionString)
myConn.Open()
Dim cmd = "Select * from [Member] where Email = @Email"
Dim myCmd As New SqlCommand(cmd, myConn)
myCmd.Parameters.AddWithValue("@Email", emailBox.Text)
Dim objReader As SqlDataReader
objReader = myCmd.ExecuteReader()
objReader.Read()
Result.Text = " " 'initialise label to show correct message for available or found
'Check the reader see if any record found matching WHERE
If (objReader.Read()) Then
'read=true, check Password
'Dim tpassword As String = objReader.GetString(5)
'If tpassword = passwordBox.Text Then
'Result.Text = "** Login Succcessful **"
Result.Text = objReader.GetString(1)
'Else
'Result.Text = "Invalid Password" & objReader.GetString(5) & passwordBox.Text
'End If
'reader=false, no such records matching WHERE
Else
Result.Text = objReader.GetString(1)
End If
myCmd.Dispose()
myConn.Dispose()
원시 SQL을 실행하면 SQL 프로파일 러를 사용하여 데이터베이스에서 모든 행을 다시 가져 옵니까? 그것은 루프에 들어가고 있습니까? – gbn
이 문제를 Fot this, no, but,하지만 나는이 행을 검색 할 수없는 SQLDataReader를 통해 행을 얻을 수 있다고 확신합니다. 나는 이미 무수히 노력했다. –