| Author |
Avoiding duplicate entries
|
|
| Mike1500 2005-02-28, 6:27 pm |
| Hello All,
I just created a user form that saves the inputted information in a SQL Server
Database. I have two questions surrounding my user form. The questions are
listed below:
- Does anyone know how to avoid duplicate entries by a user?
- Does anyone know how to change some of my text fields to a drop down list?
Any advice would be greatly appreciated. Thanks.
| |
| SnakEyez 2005-02-28, 6:27 pm |
| 1. That's not too hard. Just run a query before an insertion query that does
this: 'SELECT id FROM table WHERE id=id' If that returns an answer then you can
just return a message saying it exists, if it comes back empty then you can
just process the script normally. 2. I don't quite understand your question
here. Are you asking how to make a drop down list dependant on a text field
entry? If so I would have to suggest that you do it the other way around
because it is a lot easier to make a text input dependant on a drop-down then
it is to make a drop-down dependant on an input field, unless you just want to
test if an input field is empty or not. So would you mind explaining what you
want a little more.
| |
| CMBergin 2005-02-28, 6:29 pm |
| Set up an appropriate primary key on your table and there will be no such
thing as a duplicate; they'll be rejected by the database.
"Mike1500" <webforumsuser@macromedia.com> wrote in message
news:cvvmel$sl$1@forums.macromedia.com...
> Hello All,
>
> I just created a user form that saves the inputted information in a SQL
Server
> Database. I have two questions surrounding my user form. The questions are
> listed below:
>
> - Does anyone know how to avoid duplicate entries by a user?
> - Does anyone know how to change some of my text fields to a drop down
list?
>
> Any advice would be greatly appreciated. Thanks.
>
>
| |
| Mike1500 2005-03-01, 6:27 pm |
| Thanks for the responses but this question is for CMBergin, I have made the
appropriate changes to my database. When I entered a duplicate record in my
form and press submit button the "page cannot be displayed message came up", do
you know I can create a page that notifies the user that they entered and
duplicate record?
| |
| CMBergin 2005-03-01, 6:27 pm |
| Turn on error trapping. You haven't mentioned your server language, but
they all have some error trapping mechanism.
For instance:
On Error Resume Next
....snip....(set up insert command)
myInsertCmd.Execute()
If Err.Number <> 0 Then
Response.Write("ERROR: " & Err.Msg)
Else
Response.Redirect("SuccessPage.asp")
End If
On Error GoTo 0
"Mike1500" <webforumsuser@macromedia.com> wrote in message
news:d024n7$mqp$1@forums.macromedia.com...
> Thanks for the responses but this question is for CMBergin, I have made
the
> appropriate changes to my database. When I entered a duplicate record in
my
> form and press submit button the "page cannot be displayed message came
up", do
> you know I can create a page that notifies the user that they entered and
> duplicate record?
>
| |
| Mike1500 2005-03-01, 6:27 pm |
| Thanks for the response...The server language that I'm using is ASP. I would I began to insert that code in my webpage? Can it be done on the design view in DW? Please help. Thanks.
| |
| Les Matthews 2005-03-01, 6:27 pm |
| Why don't you take a look at the Check Username server behavior? It's
designed to prevent the insert of duplicate usernames, but can be used for
any database field - not just the username column.
"Mike1500" <webforumsuser@macromedia.com> wrote in message
news:d029kr$ve$1@forums.macromedia.com...
> Thanks for the response...The server language that I'm using is ASP. I
> would I began to insert that code in my webpage? Can it be done on the
> design view in DW? Please help. Thanks.
| |
| Mike1500 2005-03-01, 6:27 pm |
| I do not have Check Username server behavior in my DW, do you know how I can can it?
| |
| Les Matthews 2005-03-01, 6:27 pm |
| The "Check New Username" extension can be found in the set of "User
Authentication" server behaviors. It ships with UD, MX and MX2004. I assumed
you are using one of those, since you are writing ASP. What version of DW
are you using?
"Mike1500" <webforumsuser@macromedia.com> wrote in message
news:d02cnl$5k6$1@forums.macromedia.com...
>I do not have Check Username server behavior in my DW, do you know how I
>can can it?
| |
| Mike1500 2005-03-03, 6:46 pm |
| Thanks for the response...The server language that I'm using is ASP. I would I began to insert that code in my webpage? Can it be done on the design view in DW? Please help. Thanks.
| |
| Mike1500 2005-03-03, 6:46 pm |
| I do not have Check Username server behavior in my DW, do you know how I can can it?
|
|
|
|
| Copyright 2003 - 2009 forum4designers.com Software forum Computer Hardware reviews |