Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Stored Procedure help!

Status
Not open for further replies.

ebarratt

Programmer
Apr 10, 2002
53
0
0
US
Hi all,

I am having problems with an sql2000 database update stored procedure. I create the connection, command, and parameter objects and use the dbcmd.executenonquery method. It returns a 1 for one records effect as it should but it never updates the record. Here is my stored procedure could anyone tell me why it's returning 1 rows effect and the data isn't being updated?

CREATE PROCEDURE dbo.UpdateMyAccountInfo
@emailaddress as varchar(50),
@firstname as varchar(15),
@lastname as varchar(25),
@gender as char(1),
@ethnicity as char(1),
@age as varchar(2),
@city as varchar(20),
@state as varchar(2),
@zipcode as varchar(5)
AS
Update tblUsersInfo
SET usersfirstname = @firstname,
userslastname = @lastname,
usersgender = @gender,
usersethnicity = @ethnicity,
usersage = @age,
userscity = @city,
usersstate = @state,
userszipcode = @zipcode
Where usersemailaddress =@emailaddress
GO


Any help at all would be great. Thanks all! Errol Barratt
work: 856-810-5712
home: 856-697-1593
*** If there is a possibility, I'm sure all the smart ones out there will enlighten me 8p
 
OK Errol, but if we help you, you have to promise to always spell it 'anyhoo'
;)
(inside joke here in the forum)

ok, first off: your update looks fine (other than the =@emailaddress. There should be a space between = and @).

So lets look at it from a different view:

- have you tried to run the stored proc from query analyzer, using the data that you're testing your app with?
If it updates from query analyzer, then we know that its your code. If it doesn't, then obviously its not matching the usersemailaddress to the @emailaddress

- If the above doesnt' work, please post the code you're writing to show how you're updating the record. Another guy was posting about a similar issue, and it ended up being something about needing If not page.ispostback in his page load, but that was more to do with how he coded his page i think. Bottom line: it could be a code problem, in which case seeing the code would be helpful

D'Arcy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top