I have managed to get it to update but now it's adding the entry to the
next instead of relacing it but only on the forename field for eg, if
forename paul is displayed then I change it to paulc when I bring up the
recordset again it displays
paul, paulc
I have no idea what that means.
"adding the entry to the next?" What exactly is "the entry?" What exactly is
"the next?"
"But only on the forename field?" What exactly is "the forename field?" A
form field named "forename?" Or the column in the database named "forename?"
It really helps to define your terms for those of us who can't see directly
what you're doing, and must rely on you for information.
In any case, I CAN tell you this much:
ASSUMING that you have an HTML form with a form field named "forename" (or
possibly some other form field name) (and probably some other form fields?),
and that this form is for the purpose of updating or changing a record (is
that what you mean by "entry?" If so, what is "the next," and how exactly
are you "adding the entry to the next?"), and assuming that when you change
a single form field value in the ("forename" or whatever form field name it
is) form field from "paul" to "paulc," you run a SQL UPDATE query to change
the corresponding database column value in the same record, and assuming
that the corresponding column is the "user_name" column, I have a few more
questions, and some information for you:
"it displays paul, paulc"
ASSUMING that "it" is the ASP page that displays the results of the update,
which database column does the "paul" value in your page output correspond
to, and which database column does the "paulc" value in your page output
correspond to? Which of these 2 values, and the corresponding database
column does the previous HTML form's "forename" (or whatever form field name
it is) form field correspond to?
What were the previous values of these 2 database columns prior to executing
your query?
Here's the problem: Your SQL statement is concatenating 3 variables into a
SQL statement. The 3 variables it concatenates are "sEmail," "sPassword,"
and "sUserName." I have to assume that ONE (or more) of these variables are
being assigned from the Request.Form("formfield") (or whatever form field
name it is) value in the server-side code, the code that gets the form
values from the form. We have no idea which form fields these 3 variables
are being populated from, nor which of the output values you posted
corresponds to which database column. Obviously, from the context of your
message, at least ONE of them is being assigned from the "forename" (or
whatever form field name it is) field, but again, you don't specify which
one is assigned from that form field, and you don't specify which value in
the ouput page corrresponds to which database column. Any of the 3 database
columns, "email," "user_name," or "pass_word" could have a value of "paul"
or "paulc." If I were to make a few more assumptions, I could possibly rule
out the "email" column, as the value doesn't make a fully-qualified email
address. I could possibly assume, for example, that it is the "user_name"
field, as "paul" is a name for a human being, and therefore more likely not
the password.
But again, making ALL of those assumptions, I still can't figure out which
database column in the output page is "paul" or "paulc."
Hazarding a few more wild guesses, I could guess that, rather than updating
the "user_name" field, the query is updating either the "pass_word" column,
or the "email" column. This, if correct, would indicate that one or more of
the variable assignments in your form handler page are being assigned
incorrectly from the wrong form field. Which one is anyone's guess, as you
did not identify which 2 database column values are being displayed in the
output page. I could (again) make an educated guess that ONE of them is the
"user_name" column. I could NOT guess whether the value "paul" or "paulc"
corresponded to that column. As to which of the other 2 columns is being
displayed, I could not even guess.
In summary, it is not possible to know which form field is being incorrectly
assigned to which variable(s) in the form handler page. However, it is a
fairly safe guess that the "forename" (or whatever form field name it is)
form field value is being incorrectly assigned to one of the variables used
in the query.
Finally, may I point out the lengths I have gone to (and the length of my
reply!) to ensure that you understand what I mean, in order to help you. In
the future, it would be appropriate for you to take as much trouble to make
your questions understood. This would ensure that your question is answered
more quickly, and save people like me from having to work this hard to help
you! ;-)
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
I'd rather be a hammer than a nail.