Hi,
There are many scenario in c# that we need to verify for duplication check before saving records.
So I would like to know that if I have 1 database with 1 huge table filled with around 1-2 lac records say tblcustomer and if I want to check if the customer email ID in it is not duplicate then what is the best way of doing it.
Pls explain with some code if possible.
My .net application would be in c# , i may use ajax if required & backend would be sql server!
Loading
hj jhPosted Oct 1, 2012, 6:41 AM
But i think none of the answers are much satisfactory!
Because none of this ways are much efficient as far as large database is considered.
Yes I have already applied primary key to table but even after that it takes long & its not a efficient way to check for duplication in database & increase database transaction for this!
I am looking for some still better solution!
Krishna GaradPosted Oct 1, 2012, 5:09 AM
Create Procedure Sp_Check
(
@email Varchar(20),
@result Varchar(20) Out
)
As
Begin
if Exists(Select EmailId From TableName Where EmailId=@email)
Set @result='Already Available'
Else
Set @result='Not Available'
End
Sukesh MarlaPosted Oct 1, 2012, 4:26 AM
First make your column(for instance it is email id ) primary key or unique key.
Satyapriya NayakPosted Oct 1, 2012, 2:33 AM
Please refer the below links
http://www.aspdotnet-suresh.com/2011/03/how-to-check-username-availability.html
http://csharpdotnetfreak.blogspot.in/2012/05/check-username-email-availability-ajax.html
Thanks
If this post helps you mark it as answer