4
Answers

SQL Query Design functionality

David Smith

David Smith

14y
6.7k
1
I want to get opinions before I start design or functionality my query filters:

Lets Say :

I have one report with several fields:


I want to do all of these querie via the report, keep in mind  each field is coming from a drop down box, so the filters are going to be base off of the selected item from any particular dropbox, also keep in mind the drop box only has values that exists no matter what

drowDownbox 1    = A  values           drowDownbox 2    = A  values               
drowDownbox 3    = C  values          drowDownbox 4    = E  values

Select  A, B, C, D, E, F
From   Table1
Where (A = ?) And (B = ?)

Select  A, B, C, D, E, F
From   Table1
Where (A = ?) And (B = ?)

Select  A, B, C, D, E, F
From   Table1
Where (A = ?) And (B = ?)

Select  A, B, C, D, E, F
From   Table1
Where (A = ?) And (B = ?) AND (E = ?)

Select  A, B, C, D, E, F
From   Table1
Where (A = ?) And (C = 'FAIL') AND (E = 'PASS')


etc..........................

Answers (4)
0
wooi83
NA 18 0 21y
thanks for mentioning connection string. i did close the connection in the connection method. infact i mustn't do that.. thanks alot...
0
subbaram_k
NA 2 0 21y
int intParamCount = 0; SqlParameter[] sqlParam=new SqlParameter[2]; SqlCommand objInsertCommand=new SqlCommand("sp_InsertReserve",objConn); //specify the connection objInsertCommand.CommandType =CommandType.StoredProcedure; //Associate Parameters sqlParam[0]=new SqlParameter("@reservationUserID",SqlDbType.VarChar ); sqlParam[0].Direction =ParameterDirection.Input ; sqlParam[0].Value =UID; sqlParam[1]=new SqlParameter("@reservationBookID",SqlDbType.VarChar ); sqlParam[1].Direction =ParameterDirection.Input ; sqlParam[1].Value =BID; while(intParamCount
0
jaac79
NA 34 0 21y
In your code where are you setting the connection object?