Click here to Skip to main content
Rate this: bad
good
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
0 Sergey Alexandrovich Kryukov 495
1 OriginalGriff 339
2 ChintanShukla 305
3 Richard Deeming 260
4 RyanDev 230
0 Sergey Alexandrovich Kryukov 8,768
1 OriginalGriff 7,387
2 CPallini 2,603
3 Richard MacCutchan 2,095
4 Abhinav S 1,893


Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 28 Sep 2012
Copyright © CodeProject, 1999-2014
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