Click here to Skip to main content
12,354,533 members (66,813 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET
I have following function in sql server. how to use this function in front end.basically this function is for city already exist or no.so,plz help me?

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
 

ALTER FUNCTION [QAPower].[CITY_ALREADY_EXISTS] (@CITY_DESC VARCHAR(MAX),@RECORD_TYPE BIT,@COUNTRY_ID TINYINT,@CITY_ID TINYINT)
 
RETURNS BIT
 
AS
BEGIN
    DECLARE  @RESULT TINYINT
 
         IF(@RECORD_TYPE=0)
          SET @RESULT=(SELECT COUNT (*) FROM QAPower.HDR_CITY WHERE CITY_DESC=@CITY_DESC AND COUNTRY_ID=@COUNTRY_ID)
        ELSE
          SET @RESULT=(SELECT COUNT (*) FROM QAPower.HDR_CITY WHERE CITY_DESC=@CITY_DESC AND  NOT (COUNTRY_ID=@COUNTRY_ID AND CITY_ID=@CITY_ID))
 
    IF (@RESULT) > 0
        RETURN 1
    ELSE
       RETURN  0
 
    RETURN 1
END
Posted 27-Sep-12 18:00pm
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Refer:
SQL Server user-defined function[^]
how to use UDF's with asp.net[^]

..and get more simlar threads here[^].
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Hi,

See the below link. It might be help you to get idea how to call function in c#.

http://stackoverflow.com/questions/3013192/calling-sql-functions-directly-from-c-sharp[^]

Thanks,
Viprat
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 28 Sep 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100