The parameter does not effect the reader as such, but rather the query.
If it is in a book I am probably wrong about the parameter, It just didn't look right to me.
Your code looks ok aside from that to me, try this:
Code:
Dim db As SqlConnection
Dim selectcustomer As SqlCommand
Dim dtrcustomers As SqlDataReader
db = New SqlConnection("connectionstring")
db.Open()
selectcustomer = New SqlCommand("Select * from customers Where cust_ID = '" & cust_ID & "'", db)
dtrcustomers = selectcustomer.ExecuteReader()
If dtrcustomers.HasRows Then
While dtrcustomers.Read()
Response.Write(CStr(dtrcustomers.Item("cust_order")))
Response.Write("<BR>")
End While
Else
Response.Write("There are no customers")
End If
dtrcustomers.Close()
db.Close()
and if that doesn't work try without the single quotes '.
Code:
selectcustomer = New SqlCommand("Select * from customers Where cust_ID = " & cust_ID, db)
it depends on the type of the database ID "cust_ID", is it integer or varchar, etc?
Check out this link for some more info on the different ways of getting data.
BUT there is nothing wrong with how you are trying to do it, just have to keep trying until you get it right.
http://samples.gotdotnet.com/quickst...soverview.aspx
======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================