Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Duplicate Data Gridview

Hi,

I have a grid view... Contact form.
How do I make it so users cannot use the same number to contact.

Contact number is stored in the database but if the users states the same number... the form shall not submit
I am using the InsertQuery on the SQLDataSource for the grid view.
check it against what you already have before you add/ update anything.
this seems more of a logic question.
(Nov 30, 2015 07:52 AM)nathan72389 Wrote:  check it against what you already have before you add/ update anything.
this seems more of a logic question.

How do I come across to doing that
(Nov 30, 2015 07:52 AM)nathan72389 Wrote:  check it against what you already have before you add/ update anything.
this seems more of a logic question.
Agree, maybe you can use a constraint on the db table if you dont want to code it in you app.
But you will need to check the output of the instert because of contraint exception
(Nov 30, 2015 07:53 AM)TheGreat1 Wrote:  How do I come across to doing that

what!
if "A" = "B" then do "C" else do "D"
(Nov 30, 2015 07:55 AM)nathan72389 Wrote:  what!
if "A" = "B" then do "C" else do "D"

No shit dude but I'm stuck on 'How to find out if it exist in the table' rather than completing the statement
Code
Private Sub btnSubmitForm_Click(obj, e)
  If DataAccessInstance.IsNumberExists(txtPhoneNumber.Text)
    
  Else

  End If
End Sub

Then inside your IsNumberExists Method

SELECT number FROM tableName WHERE number = @number

Check the row count. Return that as a boolean result.


Done


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by draxyeeApr 28, 2020 10:33 PM 5 228 Apr 28, 2020 10:33 PM
Last Post: Shadow_Cloud
[C#] by dor343232Nov 13, 2019 02:56 AM 6 223 Nov 13, 2019 02:56 AM
Last Post: dor343232
[Python] by WoesMay 1, 2017 08:35 PM 9 323 May 1, 2017 08:35 PM
Last Post: Goodies