I do not know what is the problem. Any time I use Hasrow method I get the following error
"Compiler Error Message: BC30456: 'HasRows' is not a member of 'System.Data.SqlClient.SqlDataReader'.
Source Error:
Line 126: DRStudent = comm.executereader()
Line 127:
Line 128: if DRStudent.HasRows then
Line 129: blstudentexist = true
Line 130: else
On the top of my page I included:
<%@. import Namespace="System" %>
<%@. import Namespace="System.Data" %>
<%@. import Namespace="System.Data.SqlClient" %>
I do not know whether I need to include another import namespace...
This is the part of the code:
Conn.open()
comm.connection = conn'Verify whether the student exists
Query = " select * from tbl_student where Int_studentID = " & intSId
Comm = New SQLCommand(Query,Conn)
DRStudent = comm.executereader()if DRStudent.HasRows then
blstudentexist = true
else
blstudentexist = false
end if
DRStudent.close()
I just making a simple select and trying to know whether it has any result.
Thanks,Are you using the 1.1 version of the .NET framework? This was not supported in 1.0.|||I am using 1.1 .Net framework. How can I know whether the select query result has any record?
Thanks,|||I have no idea why you cannot use that property. It really is supported in 1.1.
There is no other way to do a non-destructive read of a DataReader (you read the row, you use it - it is a one-way firehose sort of thing).|||I am using Web Matrix and MSDE. Does this have anything to do with my problem?
Thanks,|||No. That is a property of an object in the SqlClient provider. Can you check to see if perhasp .NET version 1.0 is installed and being used instead of version 1.1?|||I think I got both. How can I check which is being used?
Thanks,|||I do not know web matrix well enough to help...|||You might find something useful in this postHOWTO: Target .NET Framework v1.1 with Web Matrix v0.6 (happened to see this in the Forum Statistics and thought you might be able to apply it to your situation)
Terri