how to store data as * format in sql

Posted by Gow.Net under Sql Server on 2/23/2012 | Points: 10 | Views : 1262 | Status : [Member] | Replies : 7
how to store data as **** format in SQL
i need one example please tell me

gowthaman8870226416


Responses

Posted by: Pradeepkumar417 on: 2/23/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,

Try this below code.

  string name = "pradeepkumar417";          

int count = name.Length;
string pwd="";
for (int i = 0; i < count; i++)
{
pwd = pwd + "*";
}


Then save this pwd into database by using insert query. the column datatype must be varchar or nvarchar.

Thanks & Regards,
Software Engineer,
Pradeep Kumar

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gow.Net on: 2/24/2012 [Member] Starter | Points: 25

Up
0
Down
thanks sir but i need how to store and retrieve in Sql database

gowthaman8870226416

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ppathi on: 2/24/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,

For Retrieve like this

Select * from siteuser where user_id='" + UserId + "' and password=cast('" + Pwd + "' as varbinary)

For Store try like this

insert into siteuser(user_id,password)values('" + user_id.Text.Trim() + "',Convert(varbinary(50),'" + password.Text.Trim() + "')

Thanks & Regards,
Pasupathi G
No Pain No Gain

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pandians on: 2/24/2012 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi

You can the following functions.. to encrypt/decrypt the confidential data...
EncryptByAsymKey
DecryptByAsymKey

It supports in SQL Server 2005 ,2008 ,2008 R2 and 2012

Please go through for details...
http://technet.microsoft.com/en-us/library/ms186950(v=sql.100).aspx

Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gow.Net on: 2/24/2012 [Member] Starter | Points: 25

Up
0
Down
hi Ppathi sir
thanks but please tell me clearly

i give Input username:gowthaman password:12345 this information store in database in ****** format and retrieve original data how?

gowthaman8870226416

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Neer on: 2/24/2012 [Member] Starter | Points: 25

Up
0
Down
u cant. its better to use encryption and decryption so that ur data would not b in readable format.

but u can decrypt n read.

-Neer

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gow.Net on: 2/25/2012 [Member] Starter | Points: 25

Up
0
Down
thank u sir

gowthaman8870226416

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response