I have a case where I'm given a variable and asked to check the existence of this variable in a db. If it exists, I'm asked to return the relevant row to my application (in this case my asp.net app)
What is the most efficient way of doing this? I've read the books, the forums, tested my own stuff.... there are so many ways of doing what I want to do.
My goal is to use as little processing power as possible. From what I've read, I'm guessing that using a dataReader is the way to go?
In my first dry run, I did not use a dataReader.
I have 2 issues with my code:Code:Dim sqlQuery As String = "SELECT * FROM lostpass WHERE username = @username" Dim connect As SqlConnection = New SqlConnection(connStr) Dim cmd As SqlCommand = New SqlCommand(sqlQuery,connect) cmd.Parameters.AddWithValue("@username", username) Dim da As SqlDataAdapter = New SqlDataAdapter(cmd) Dim ds As DataSet = New DataSet() If Not IsNothing(da) Then da.Fill(ds) da.Dispose() End If End If
1) I'm not sure if it's the most efficient way to go
2) I can't for the life of me get to my record in the dataset
I really could use a pointer or three.
Thank you,
MizPippz




Reply With Quote