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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transformation of SQL function into C# - How To Do It?

Status
Not open for further replies.

Christin Lange

Programmer
May 16, 2017
2
US
CREATE FUNCTION [dbo].[ufn_EncryptString] ( @pClearString VARCHAR(100) )
RETURNS NVARCHAR(100) WITH ENCRYPTION AS
BEGIN

DECLARE @vEncryptedString NVARCHAR(100)
DECLARE @vIdx INT
DECLARE @vBaseIncrement INT

SET @vIdx = 1
SET @vBaseIncrement = 128
SET @vEncryptedString = ''

WHILE @vIdx <= LEN(@pClearString)
BEGIN
SET @vEncryptedString = @vEncryptedString +
NCHAR(ASCII(SUBSTRING(@pClearString, @vIdx, 1)) +
@vBaseIncrement + @vIdx - 1)
SET @vIdx = @vIdx + 1
END

RETURN @vEncryptedString

I would like to know the C# function for the above mentioned SQL function. I would appreciate if professionals and experts of top software development companies in Dubai help me with it. The reason of getting the help from professionals of top companies is the fact that these people would have already experienced it. Moreover, it is an ultimate fact that people learn a lot from practice rather than just theory.

Can anyone help me workout the same function in C#?
 
Your code looks like SQLServer TSQL. Its definatley not SQLBase or SQLWindows . I think you might be in the wrong forum.
Alternatively , forget about C# , and I'll do it for you in Gupta SQLwindows ( TeamDeveloper ) , in about 1/2 the time, and 1/2 the number of lines.

GuptaSteve

See us for all Gupta / Centura SQLWindows / SQLBase help at:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top