Im having a table called transaktions where i inserted customers billings and customer number. My primary key is an int id that has identity specifikation. My question is how do i select all rows that contains a specific customer_nr and returns all the results?
Right now im doing:
public string getCustomerTransaktions(string CustNr)
{
using (var cmd = new SqlCommand("select billing_name from [transaktions] where customer_nr = @customer_nr", Connect()))
{
cmd.Parameters.AddWithValue("@customer_nr", custNr);
using (var er = cmd.ExecuteReader())
{
if (er.Read())
{
return (string)er["billing_name"];
}
}
}
return "UNKNOWN";
}
This will only print the first row that matches the customer nr, there are atleast 20 rows left. Anyone have any suggestion that will help me? Best Regards