473,396 Members | 1,816 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,396 software developers and data experts.

Update_Customer not working

My TRY CATCH shows Error when I run this. Can anyone see what's wrong
with this? Each textbox has OnTextChanged="ConChanged". This changed
boolean to TRUE and then Updates the customer.

Sub Update_Customer()

Dim strText as string

Dim strSQL as string = "UPDATE tblCustomers SET " & _
"(strEmail, strFName, strLName, strStreet, strCity, strState,
strZip) VALUES (" & _
"'" & tbEmail.text & "'," & _
"'" & tbFName.text & "'," & _
"'" & tbLName.text & "'," & _
"'" & tbStreet.text & "'," & _
"'" & tbCity.text & "'," & _
"'" & tbState.text & "'," & _
"'" & tbZip.text & "');"

'Dim strSQL as string = "UPDATE tblCustomers SET strEmail = '" &
tbEmail.text & "', strFName = '" & tbFName.text & "', " & _
' "strLName = '" & tbLName.text & "', strStreet =
'" & tbStreet.text & "', strCity = '" & tbCity.text & "', " & _
' "strState = '" & tbState.text & "', strZip = '"
& tbZip.text & "' WHERE CustID = " & ViewState("CustID") & ";"
TRY

Dim objConnection as New OLEDBConnection(myConnection)
Dim objCmd as New OLEDBCommand(strSQL, objConnection)
objCmd.Connection.Open()
objCmd.ExecuteNonQuery

Response.redirect("CheckOut.aspx?order=ASDF")
objCmd.Connection.Close()

Catch objError as Exception
Response.Write("Error")
END TRY

AddMe.Visible = FALSE
Success.Visible = TRUE
END Sub

Nov 19 '05 #1
5 930
Even the strSQL that I have commented out doesn't work. I can't figure
this out for the life of me!

Nov 19 '05 #2
Hi,

Could you set a break point on:

Response.Write("Error")

And then tell us what objError.Message says. From there we should be able
to figure this out. Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Sparky Arbuckle" <tw*@secureroot.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
My TRY CATCH shows Error when I run this. Can anyone see what's wrong
with this? Each textbox has OnTextChanged="ConChanged". This changed
boolean to TRUE and then Updates the customer.

Sub Update_Customer()

Dim strText as string

Dim strSQL as string = "UPDATE tblCustomers SET " & _
"(strEmail, strFName, strLName, strStreet, strCity, strState,
strZip) VALUES (" & _
"'" & tbEmail.text & "'," & _
"'" & tbFName.text & "'," & _
"'" & tbLName.text & "'," & _
"'" & tbStreet.text & "'," & _
"'" & tbCity.text & "'," & _
"'" & tbState.text & "'," & _
"'" & tbZip.text & "');"

'Dim strSQL as string = "UPDATE tblCustomers SET strEmail = '" &
tbEmail.text & "', strFName = '" & tbFName.text & "', " & _
' "strLName = '" & tbLName.text & "', strStreet =
'" & tbStreet.text & "', strCity = '" & tbCity.text & "', " & _
' "strState = '" & tbState.text & "', strZip = '"
& tbZip.text & "' WHERE CustID = " & ViewState("CustID") & ";"
TRY

Dim objConnection as New OLEDBConnection(myConnection)
Dim objCmd as New OLEDBCommand(strSQL, objConnection)
objCmd.Connection.Open()
objCmd.ExecuteNonQuery

Response.redirect("CheckOut.aspx?order=ASDF")
objCmd.Connection.Close()

Catch objError as Exception
Response.Write("Error")
END TRY

AddMe.Visible = FALSE
Success.Visible = TRUE
END Sub

Nov 19 '05 #3
What is a breakpoint?

Nov 19 '05 #4
Sparky ,
Are you using VS.NET?
Break point is under the Menu "Debug" .

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #5
Hi,

A breakpoint halts execution and let's you step through your code line by
line so you can check values. If you are using VS.Net you can just click to
the left of the Response.Write("Error") line and it will set a breakpoint.
Alternatively change:

Response.Write("Error")

To

Response.Write(objError.Message)

Then run your code. This will print out the error message you are receiving
and that error message should tell us pretty specifically why your code is
erroring out. Actually put the line below there instead and we should be
able to figure this out even faster:

Response.Write("Error Message: " + objError.Message + " - SQL: " +
strSQL)

This will now print out the error message and the SQL that you are using.
It should put it write in your browser when you run the app so you'll just
need to copy and paste it into your response. Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Sparky Arbuckle" <tw*@secureroot.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
What is a breakpoint?

Nov 19 '05 #6

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

Similar topics

2
by: Gary | last post by:
I am trying to use the "System.Windows.Forms.SendKeys" class for triggering the Ctrl+P key. Syntax: System.Windows.Forms.SendKeys.Send("^(P)"); This is not working ..what could be the...
6
by: Mullin Yu | last post by:
hi, i have a web service that has file operations on Windows OS, and there may be a file concurrency issue if only one working directory e.g. c:\working therefore, i want to have a unique sub...
3
by: | last post by:
Hello, I am hoping someone else has thought about a date time calculation i need to perform. I would like to be able to calculate the number of "working minutes" between 2 dates, given my...
8
by: Hardy Wang | last post by:
Hi: Is it possible for me to create/open web application from remote machine other than port 80? And create application directly under virtual web site instead of creating a virtual directory?...
5
by: Martin Heuckeroth | last post by:
Hi We are working on a webservice application and are having some problems with the cookies and/or sessions. We have them working on our intranet but then its not working on the internet. We...
5
by: tshad | last post by:
I have been working with setting my drop boxes to allow double clicking to select an item. It worked fine until I made some changes. I then stripped the page down to the bare essentials to find...
8
by: jojobar | last post by:
Okay, I am trying to do is to test the webresource in 2.0 1. I created a new project with assembly name (and default assembly name) "Office". 2. I added the following to the AssemblyInfo.cs...
2
by: Don | last post by:
I'm having problems with intellisense, autocomplete, etc. suddenly not working in certain classes of a project I'm working on. All the options are set, and it all works fine for most classes, but...
9
by: MSDNAndi | last post by:
Hi, I have a set of simple webservices calls that worked fine using .NET Framework 1.0. I am calling a Java/Apache based webservices, the calling side is not able to supply a proper WSDL. ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.