Multi-Parameter Search in C#

Apr 24 2007 3:24 PM

Very new to C#, so this maybe really easy.  I am changing a VBA/SQL Application over to C#/SQL and am trying to find a way to switch the below function into a SQL Stored Procedure in C# or similar type function. 

The below VBA function, will search a SQL db based on One or more or none parameters keyed on a form.
*-----------------------------------------------------------------------------------------
SELECT AlertID, Alertdate, Region, intBranch AS HMO, AlertLevel, Acctnum, AccountName, EMV, AlertReasonCode, QACatagory, IntialConcern, KAE, OtherEMV, PPA, Accs
FROM tblClientAlerts
WHERE ([alertid]=[Forms]![frmAmsSrch]![txtAlertIDSrch].[Value] or [Forms]![FrmAmsSrch]![txtAlertIDSrch].[Value] is Null)
And
([AcctNum]=[Forms]![frmAmsSrch]![txtAcctSrch].[Value] or [Forms]![FrmAmsSrch]![txtAcctSrch].[Value] is Null)
And
([AlertReasonCode]=[Forms]![frmAmsSrch]![cboAlertCatSrch].[Value] or [Forms]![FrmAmsSrch]![cboAlertCATSrch].[Value] is Null)
And
([alertLevel]=[Forms]![frmAmsSrch]![cboAlertLvlSrch].[Value] or [Forms]![FrmAmsSrch]![cboAlertLvlSrch].[Value] is Null)
And
([Region]=[Forms]![frmAmsSrch]![cboRegions].[Value] or [Forms]![FrmAmsSrch]![cboRegions].[Value] is Null)
And
([QaCatagory]=[Forms]![frmAmsSrch]![cboQA].[value] or [Forms]![FrmAmsSrch]![cboQA].[Value] is Null)
And
([EMV]>=[Forms]![frmAmsSrch]![txtEMV].[value] or [Forms]![frmAmsSrch]![txtEMV].[value] is null)
And
([EnterDT] Between [Forms]![frmAmsSrch]![txtDate].[value] and [Forms]![frmAmsSrch]![txtDate2].[value]);
*-------------------------------------------------------------------------------------------


Answers (1)