473,322 Members | 1,241 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Growl- frustrating - update function DOESN'T DO ANYTHING

I am feeling frustrated and I am willing to bet its something stupid but I
could really use some help.

I have a class called anEvent. On my web form I have a button which creates
a new anEvent and loads the form data into the new event. It then sends that
event to a class function to try and update the data in the database. When
I hit the button, it appears that nothing happens, no error message, just a
return to the previous state of the controls. I have tried catching errors,
using try - catch to see if something is failing somewhere but have gotten
bascially nowhere. I have tried simplifying the query so much that its
"update tblevents set eventname= @eventname where eventid=@eventid" and
still nothing happens. Please help if you can. Thanks in advance!!

Class:
Public Class anEvent
Public EventName As String
Public Location As String
Public StartDate As DateTime
Public EndDate As DateTime
Public Address As String
Public City As String
Public State As String
Public Zip As String
Public Phone As String
Public ContactPhone As String
Public ContactName As String
Public ContactEmail As String
Public RoomRate As String
Public ReservationCode As String
Public STatus As Integer
Public DateOpened As DateTime
Public Dateclosed As DateTime
Public Additional As String
Public EventID As Integer
End Class
CodeBehind for button:

Private Sub btnUpdateThisEvent_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnUpdateThisEvent.Click
Dim CurrentEvent As New anEvent
Dim URLString As String
CurrentEvent.EventName = txtEventName.Text
CurrentEvent.Location = txtLocation.Text
CurrentEvent.Address = txtAddress.Text
CurrentEvent.City = txtCity.Text
CurrentEvent.State = txtState.Text
CurrentEvent.Zip = txtZip.Text
CurrentEvent.Phone = txtPhone.Text
CurrentEvent.StartDate = txtStartDate.Text
CurrentEvent.EndDate = txtEndDate.Text
CurrentEvent.ContactName = txtContactName.Text
CurrentEvent.ContactPhone = txtContactPhone.Text
CurrentEvent.ContactEmail = txtContactEmail.Text
CurrentEvent.Additional = txtAdditional.Text
CurrentEvent.RoomRate = txtRoomRate.Text
CurrentEvent.ReservationCode = txtReservationCode.Text
CurrentEvent.STatus = ddlStatus.SelectedItem.Value
CurrentEvent.EventID = txtEventID.Text
E_VentManager.EventsDB.UpdateEvent(CurrentEvent)
End Sub
Code for: E_ventManager.EventsDB.UpdateEvent:
Public Shared Function UpdateEvent(ByVal CurrentEvent As anEvent) As Boolean

Dim conEvents As New SqlConnection
conEvents.ConnectionString =
ConfigurationSettings.AppSettings("ConnectionStrin g")
Dim cmdEvents As New SqlCommand
cmdEvents.CommandType = CommandType.StoredProcedure
cmdEvents.CommandText = "spUpdateEvent"
cmdEvents.Connection = conEvents
cmdEvents.Parameters.Add("@EventName", CurrentEvent.EventName)
cmdEvents.Parameters.Add("@Location", CurrentEvent.Location)
cmdEvents.Parameters.Add("@StartDate", CurrentEvent.StartDate)
cmdEvents.Parameters.Add("@EndDate", CurrentEvent.EndDate)
cmdEvents.Parameters.Add("@Address", CurrentEvent.Address)
cmdEvents.Parameters.Add("@City", CurrentEvent.City)
cmdEvents.Parameters.Add("@State", CurrentEvent.State)
cmdEvents.Parameters.Add("@Zip", CurrentEvent.Zip)
cmdEvents.Parameters.Add("@pHONE", CurrentEvent.Phone)
cmdEvents.Parameters.Add("@ContactName", CurrentEvent.ContactName)
cmdEvents.Parameters.Add("@ContactPhone", CurrentEvent.ContactPhone)
cmdEvents.Parameters.Add("@ContactEmail", CurrentEvent.ContactEmail)
cmdEvents.Parameters.Add("@RoomRate", CurrentEvent.RoomRate)
cmdEvents.Parameters.Add("@ReservationCode", CurrentEvent.ReservationCode)
cmdEvents.Parameters.Add("@Additional", CurrentEvent.Additional)
cmdEvents.Parameters.Add("@Status", CurrentEvent.STatus)
cmdEvents.Parameters.Add("@EventID", CurrentEvent.EventID)
conEvents.Open()
cmdEvents.ExecuteNonQuery()
conEvents.Close()

End Function
Nov 19 '05 #1
4 1142
oh yes, and the stored procedure:
CREATE PROCEDURE spUpdateEvent
@EventName varchar(50),
@location varchar(50),
@Phone varchar(50),
@StartDate datetime,
@EndDate datetime,
@Address varchar(255),
@City varchar(50),
@State varchar(50),
@Zip varchar(50),
@ContactName varchar(50),
@ContactPhone varchar(50),
@ContactEmail varchar(50),
@RoomRate varchar(50),
@ReservationCode varchar(50),
@Status integer,
@Additional ntext,
@EventID integer
AS
Begin Transaction
UPDATE tblEvents set EventName = @EventName,
Location = @Location,
Phone = @Phone,
StartDate = @StartDate,
EndDate = @EndDate,
Address = @Address,
City = @City,
State = @State,
Zip = @Zip,
ContactName = @ContactName,
ContactPhone = @ContactPhone,
ContactEmail = @ContactEmail,
RoomRate = @RoomRate,
ReservationCode = @ReservationCode,
Status = @Status,
Additional = @Additional
Where EventID = @EventID
if @@error <> 0 goto Errorhandler
Commit Transaction
return
Errorhandler:
rollback transaction
return
GO
Nov 19 '05 #2
When u say returned to the previous state of the controls
what do u mean?
Is that all ur code?

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #3

"Patrick Olurotimi Ige" <na********@hotmail.com> wrote in message
news:O4**************@TK2MSFTNGP09.phx.gbl...
When u say returned to the previous state of the controls
what do u mean?
I change the data in the form, I click the button. The data reverts
OOOOOOOOOOOOOOOOOHHHHHHHHHHHHHH
I am such an idiot. I forgot my not is postback and the page is doing the
page load function every time.

Is that all ur code?

Yes and hugs and kisses to you because your post turned my brain on!
Nov 19 '05 #4
Child wrote:
[snip]
cmdEvents.CommandType = CommandType.StoredProcedure
cmdEvents.CommandText = "spUpdateEvent"

[snip]

Just a sidenote: you should not prefix your SqlServer stored procedures
with "sp" as that will cause SqlServer to look first in "master" and only when
nothing is found there, in your own db. The same probably goes for "xp".

Hans Kesting
Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Player | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello I am teaching myself python, and I have gotten a long way, it's quite a decent language and the syntax is great :) However I am having a...
11
by: John Salerno | last post by:
My general problem with events seems to be that there are so many parts to them, and I'm not sure where they all go or when you use which parts. For example, there's the delegate, the event name,...
71
by: Randy Harris | last post by:
I've recently joined several others in attempt to discourage Steve Santos from advertising his PC Datasheet business on CDMA. Among the hundreds of professional consultants who contribute to CDMA,...
10
by: MLH | last post by:
?DCount("!", "qryAOLsNeed2Print") - OR - ?DCount(".", "qryAOLsNeed2Print") Both syntaxes return the correct answer for me. But I'm wondering if one is more suitable than the other for some...
9
by: Mike C# | last post by:
Hi all, Running into a little problem. I wrote a small app on VC++ 7.1 that calls the GetDefaultPrinter() function. Now I have to "downgrade" it to VC++ 6, but every time I compile I get the...
4
by: Growl | last post by:
Hi, i'm a beginner of C++ and would like some help figuring out some things, any suggestions would be appreciated. I'm trying to search a word in an array and if it's found, the output would...
7
by: Mag Gam | last post by:
I have a file similar to this: <Customer xmlns="http://www.localsite.com/ecommerce/2006-v01/ organization"> <ns1:Contract xmlns:ns1="http://www.localsite.com/ecommerce/2006-v01/ portfolio">...
5
by: helPlease | last post by:
By long integer i mean very large number(say of 20 digits).If i store it in a character array then what mechanism shud i follow to multiply two such numbers.Could Booth's algo. be applied.Or if...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.