Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL has never been my strong point,

Status
Not open for further replies.

Deltaflyer

Programmer
Oct 11, 2000
184
GB
SQL has never been my strong point, but i am pretty sure that this coding ( found at bottom of text ) is correct for use in Interdev.

The SQL statement works ok as long as i don't put the last line in, (ORDER BY DomainID).

I must be missing something obvious, so please call me a fool if you feel like it.
(Only as long as i deserve it though!!!)

SQL Statement
-------------

If (DomainID <> &quot;&quot;) Then
SQL = &quot;SELECT * FROM tbl where DomainID LIKE '&quot; & DomainID & &quot;'&quot;
ElseIf (FirstName <> &quot;&quot;) Then
strSQL = &quot;SELECT * FROM Tbl_peo_People where FirstName LIKE '&quot; & FirstName & &quot;'&quot;
End if
strSQL = strSQL & &quot; ORDER BY DomainID&quot;
[sig][/sig]
 
Does Tbl_peo_People have a field called DomainID? If it doesn't you would not be able to order by it when the elseif happened.

Another option would be to use two different stored procedures and then call the one you require based on the domainID and firstName contents as parameters. [sig]<p>Crystal<br><a href=mailto:crystals@genesis.sk.ca>crystals@genesis.sk.ca</a><br><a href= > </a><br>--------------------------------------------------<br>
Experience is one thing you can't get for nothing.<br>
-Oscar Wilde<br>
[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top