Click here to Skip to main content
15,917,574 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How encrypt a column in SQL database by c# and search them by using like'%%' instead of equal?

For example I have a column by'c1' name and column data are encrypted. Now how I can use this query?
Query:
Select * from [ table ] where [c1] like '%any thing%'
Posted

1 solution

U Have to first define encrypt() and decrypt() functions in sql and while searching any thing you should use decrypt() function to match your word.
 
Share this answer
 
Comments
saber rezaii magham 29-Jul-14 5:14am    
Yes this is true,
But I don't know how define encrypt() and decrypt() function in SQL and then call them in c#?
Sid_Joshi 29-Jul-14 5:21am    
find ascii number of each character and add a specific number to that character ascii number, you will get new number and new encrypted character with that numbar
Sid_Joshi 29-Jul-14 5:23am    
ex select ASCII ('a') you will get 97 as ascii number add 50 in that numbar character will automatically encrypt
saber rezaii magham 29-Jul-14 5:27am    
Thank you!
This is a very good and simple way.
So I must build a new encrypt/decrypt algorithm for my self.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900