hey coders, hope you guys can help me out again!
i'm using entlib's daab to connect to my sql database which is working find but i'm faced with a little problem, so help me out with this.
i would like to determine if a cetain entry is already contained within the database, for this i have two columns in the table that I reference "DataID" and "UserID", where DataID is a uniqueidentified value which is retrieved according to an ID that is passed to my method. the UserID is passed at run-time, look at the following piece of code
Dim _Database as Database = DatabaseFactory.CreateDatabase [Data Access Block]
Dim _Reader as IDatareader = _Database.ExecuteReader(CommandType.Text, "SELECT * FROM Data WHERE DataID = '" & _DataID & "' AND UserID = '" & _UserID & "'")
as you can see this is a standard ADO.Net type query and should return the data, if any exists in the database back to the reader. my problem is that i cannot use the datareader's hasrows method because i'm referencing the idatareader directly.
how can i determine if _reader contains any values or rows....
i know that an alternative would be to use a dataset, but i'm looking for a readonly, once-off connection to the database.
Enter your message below
Sign in or Join us (it's free).