I have a select statement which requires numerous parameters.
here is a snippet.
SqlCommand cmd = new SqlCommand("SELECT this from MyTable WHERE Answer1 = @Att 1AND Answer2 = @Att2 AND Answer3 = @Att3", connection)
my parameters are added as follows.
SqlParameter Att1 = new SqlParameter("@Att1", SqlDbType.VarChar, 50);
Att1.Value = Attributes1;
and so on...
What I would like to do is be able to remove a parameter and re-run the SELECT statement if the number of entries retrieved is less than 5 (or any number)
I tried just having a new Sql command like this.
SqlCommand cmd2 = new SqlCommand("SELECT this from MyTable WHERE Answer1
= @Att 1AND Answer2 = @Att2, connection)
and then did this..
but it didn't work.
Is there a way to do this so I don't have to keep copying the whole parameter command
Thank you in advance for your help. And please be gentle, I'm very new to this.