Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

Help with SQL Stored procedure -


i need sql stored procedure, haven't got alot of experience it. have table "dbo.lookup_country". contains 3 fields: id, name, code. wrote stored procedure retrieves country name code.

select name lookup_country code = @code 

i need adjust stored procedure if there 0 results has see if there results searching id:

select name lookup_country id = @code

so need kind of 'if' structure:

if (select name lookup_country code = @code) == 0 results       select name lookup_country id = @code 

is possible?

thx

thx everyone, used this:

declare @name nvarchar(50)  -- insert statements procedure here set @name = (select name dbo.lookup_country code = @code) if @name != ''     select name dbo.lookup_country code = @code else     select name dbo.lookup_country id = @code 

put results of first select variable, can count on result, , if 0 search id.

to learn more how use if statement check out article, if using sql server, but, if using different database logic still applies if syntax may differ.

http://msdn.microsoft.com/en-us/library/ms182587.aspx


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -