Re: Database Search Question
Another way of doing it would be to loop through each item in my listview but my questions then are.
For Each item in UsersListView
Next
Question, how do i get the value from the 3rd or 4th coloumn and how do i update a row?
Re: Database Search Question
A better way to do this write a SQL statment that already counts the orders for each Person
Roughly:
Code:
SELECT
Prs.Id
, Prs.Name
, Prs.Surname
, Prs.Gender
, Count(Ord.OrderID) as NumberOfOrders
FROM
Person Prs
INNER JOIN
Orders Ord
ON
Ord.PersonId = Prs.Id
GROUP BY
Prs.Id
, Prs.Name
, Prs.Surname
, Prs.Gender
Re: Database Search Question
You get that error because you have this command
Code:
command2.ExecuteScalar
executing against the same connection as
Code:
command.ExecuteReader
The join that Dnereb gives you would solve your problem.