ah ok you had that in the catch it was not a YSOD. My bad.
Trace is one of best parts of .net once you learned to read the
display it helps you reduce viewstate and know millisecond timing
between trace points to optimize code.
Plus you can check it as a boolean
If trace.isenabled()
.... do a ton of stuff ....
end if
and do things to page only if trace is on (add grid controls, etc.)
Trace.axd is even more amazing. Since if you included trace.write in
your code you can see the diagnostic data from previous requests.
try out
http://www.learnasp.com/freebook/learn/debug1.aspx
to see what I mean.
On Sat, 22 Jan 2005 18:15:54 -0500,
[EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> I did that and here is what I got"
>
> Request Details
> Session Id: 1bv3nk45kmd1fd3wdals5k55 Request Type: POST
> Time of Request: 1/22/2005 6:14:42 PM Status Code: 200
> Request Encoding: Unicode (UTF-8) Response Encoding: Unicode (UTF-8)
> Trace Information
> Category Message From First(s) From Last(s)
> aspx.page Begin PreInit
> aspx.page End PreInit 0.000120685695895513 0.000121
> aspx.page Begin Init 0.000206171397154835 0.000085
> aspx.page End Init 0.000641980854555298 0.000436
> aspx.page Begin InitComplete 0.000730818936256162 0.000089
> aspx.page End InitComplete 0.000795352259755846 0.000065
> aspx.page Begin LoadState 0.000854857012593217 0.000060
> aspx.page End LoadState 0.00127306647267559 0.000418
> aspx.page Begin ProcessPostData 0.00137196169570107 0.000099
> aspx.page End ProcessPostData 0.00192761875388667 0.000556
> aspx.page Begin PreLoad 0.0020122663600356 0.000085
> aspx.page End PreLoad 0.00221340918652812 0.000201
> aspx.page Begin Load 0.00228297108069012 0.000070
> aspx.page End Load 0.00240784725213756 0.000125
> aspx.page Begin ProcessPostData Second Try 0.00249081866806573 0.000083
> aspx.page End ProcessPostData Second Try 0.00254864723068233 0.000058
> aspx.page Begin Raise ChangedEvents 0.00260396150796777 0.000055
> aspx.page End Raise ChangedEvents 0.00269196149455825 0.000088
> aspx.page Begin Raise PostBackEvent 0.00274979005717485 0.000058
> bad thing very bad
> Syntax error in UPDATE statement.
> at
> System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult
> hr)
> at
> System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
> dbParams, Object& executeResult)
> at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
> executeResult)
> at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
> behavior,
> Object& executeResult)
> at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
> behavior, String method)
> at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
> at btcNET.EditBTCMember.SubmitBTCedit_Click(Object sender, EventArgs e)
> in
> \\webslave\wwwroot$\btcNET\EditBTCMember.aspx.vb:line 189 0.380488475354137
> 0.377739
> aspx.page End Raise PostBackEvent 2.19977170289193 1.819283
> aspx.page Begin LoadComplete 2.19997033143309 0.000199
> aspx.page End LoadComplete 2.20003654094681 0.000066
> aspx.page Begin PreRender 2.20009604569965 0.000060
> aspx.page End PreRender 2.20020080758845 0.000105
> aspx.page Begin PreRenderComplete 2.20026198853151 0.000061
> aspx.page End PreRenderComplete 2.20032065518923 0.000059
> aspx.page Begin SaveState 2.21845451909264 0.018134
> aspx.page End SaveState 2.21931021420035 0.000856
> aspx.page Begin SaveStateComplete 2.21942251894514 0.000112
> aspx.page End SaveStateComplete 2.21950884274151 0.000086
> aspx.page Begin Render 2.21956667130413 0.000058
> aspx.page End Render
>
> -----Original Message-----
> From: Charles Carroll [mailto:[EMAIL PROTECTED]
> Sent: Saturday, January 22, 2005 5:59 PM
> To: [email protected]
> Subject: Re: [AspNetAnyQuestionIsOk] RE: Btc Edit Profile using your style
>
>
> Once again add the
> TRY / CATCH / FINALLY
> I pointed you to. Then it won't die with YSOD and we can read the SQL
> statement.
>
> Catch exc1 as exception
> Trace.write("bad thing","very bad",exc1)
>
> is a minimal CATCH handler although I also recommend sending a message
> to the page ina literal as well.
>
>
> On Sat, 22 Jan 2005 17:28:39 -0500,
> [EMAIL PROTECTED]
> <[EMAIL PROTECTED]> wrote:
> > Wow the trace spits back a lot of stuff. Here is the error from the
> trace.
> >
> >
> >
> >
> >
> > Unhandled Execution Error
> >
> >
> > Syntax error in UPDATE statement.
> > at
> >
> System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult
> > hr)
> > at
> >
> System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
> > dbParams, Object& executeResult)
> > at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
> > executeResult)
> > at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
> > behavior,
> > Object& executeResult)
> > at
> System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
> > behavior, String method)
> > at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
> > at btcNET.EditBTCMember.SubmitBTCedit_Click(Object sender, EventArgs
> e)
> > in
> > \\web\wwwroot$\btcNET\EditBTCMember.aspx.vb:line 189
> > at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
> > at System.Web.UI.WebControls.Button.RaisePostBackEvent(String
> > eventArgument)
> > at
> >
> System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePo
> > stBackEvent(String eventArgument)
> > at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
> > sourceControl, String eventArgument)
> > at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
> > at System.Web.UI.Page.ProcessRequestMain(Boolean
> > includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
> >
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: Charles Carroll [mailto:[EMAIL PROTECTED]
> > Sent: Saturday, January 22, 2005 4:29 PM
> > To: [email protected]
> > Subject: Re: [AspNetAnyQuestionIsOk] RE: Btc Edit Profile using your
> style
> >
> >
> >
> >
> >
> > You need to trace.write your SQL
> >
> >
> >
> >
> >
> > <%@ trace="true"%>
> >
> > at top of file.
> >
> >
> >
> > trace.write ("here is my SQL", strSQL)
> >
> > in your code. Then we can track down the problem.
> >
> >
> >
> > You also need to be using TRY/CATCH/FINALLY in your code so if future
> >
> > problems happen you can avoid users seeing the Yellow Screen of Death
> >
> > (YSOD).
> >
> >
> >
> > http://www.learnasp.com/freebook/learn/cs_dbtable.aspx
> >
> > (C#)
> >
> >
> >
> > http://www.learnasp.com/freebook/learn/dbopen.aspx
> >
> > (VB.net)
> >
> >
> >
> > shows the basic structure of TRY/CATCH/FINALLY and good connection
> >
> > closing best practices as well.
> >
> >
> >
> > You can also alternatively use UtiltyBelt DBexec, GenerateInsert,
> >
> > GenerateUpdate features i.e.
> >
> > http://www.learnasp.com/freebook/learn/ub_dbexec.aspx
> >
> >
> http://www.learnasp.com/freebook/learn/utilitybelt_sqlgenerateinsert.aspx
> >
> >
> http://www.learnasp.com/freebook/learn/utilitybelt_sqlgenerateupdate.aspx
> >
> >
> >
> >
> >
> > On Sat, 22 Jan 2005 15:38:17 -0500, mbelcher <[EMAIL PROTECTED]> wrote:
> >
> > >
> >
> > >
> >
> > > I have the entire thing working except when I try to Update the
> record.
> > I
> >
> > > keep getting an error. I am going by the username but playingname is
> the
> >
> > > primary key in the table. . Here is there error with code below. If I
> > get
> >
> > > this to work I guess doing a delete would be easy then. Once this all
> > works
> >
> > > things should be easy. Here is the page that I am working on
> >
> > >
> >
> > > http://BelchingToadClan.gotdns.com/btcNET/EditBTCMember.aspx
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > > error
> >
> > > Syntax error in UPDATE statement.
> >
> > >
> >
> > >
> >
> > > Description: An unhandled exception occurred during the execution of
> the
> >
> > > current web request. Please review the stack trace for more
> information
> >
> > > about the error and where it originated in the code.
> >
> > >
> >
> > > Exception Details: System.Data.OleDb.OleDbException: Syntax error in
> > UPDATE
> >
> > > statement.
> >
> > >
> >
> > > Source Error:
> >
> > >
> >
> > >
> >
> > > An unhandled exception was generated during the execution of the
> current
> >
> > > web
> >
> > > request. Information regarding the origin and location of the
> exception
> > can
> >
> > > be identified using the exception stack trace below.
> >
> > >
> >
> > >
> >
> > > Stack Trace:
> >
> > >
> >
> > >
> >
> > >
> >
> > > [OleDbException (0x80040e14): Syntax error in UPDATE statement.]
> >
> > >
> >
> > >
> >
> System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult
> >
> > > hr) +42
> >
> > >
> >
> > >
> >
> System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
> >
> > > dbParams, Object& executeResult) +290
> >
> > > System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
> > executeResult)
> >
> > > +156
> >
> > > System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
> > behavior,
> >
> > > Object& executeResult) +62
> >
> > >
> System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
> >
> > > behavior, String method) +110
> >
> > > System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +102
> >
> > > btcNET.EditBTCMember.SubmitBTCedit_Click(Object sender, EventArgs
> e)
> > in
> >
> > > \\webslave\wwwroot$\btcNET\EditBTCMember.aspx.vb:189
> >
> > > System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
> >
> > > System.Web.UI.WebControls.Button.RaisePostBackEvent(String
> >
> > > eventArgument)
> >
> > > +232
> >
> > >
> >
> > >
> >
> System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePo
> >
> > > stBackEvent(String eventArgument) +5
> >
> > > System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
> >
> > > sourceControl, String eventArgument) +11
> >
> > > System.Web.UI.Page.RaisePostBackEvent(NameValueCollection
> postData)
> > +31
> >
> > > System.Web.UI.Page.ProcessRequestMain(Boolean
> >
> > > includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
> > +5157
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > > <CODE>
> >
> > >
> >
> > > Private Sub SubmitBTCedit_Click(ByVal sender As System.Object, ByVal
> e
> > As
> >
> > > System.EventArgs) Handles SubmitBTCedit.Click
> >
> > >
> >
> > >
> >
> > >
> >
> > > 'Edit Code to UPDATE
> >
> > > here..............................................................
> >
> > >
> >
> > > ' String sSQLCommand = "UPDATE tblBTC SET Age = 27 WHERE
> >
> > > FirstName
> >
> > > = 'Peter'";
> >
> > >
> >
> > >
> >
> > >
> >
> > > '---------- Get Username from username textbox ----------
> >
> > >
> >
> > > Dim strUsernameWeb As String
> >
> > >
> >
> > > strUsernameWeb = Username.Text
> >
> > >
> >
> > > 'Response.Write(strUsernameWeb)
> >
> > >
> >
> > > '------------------------------------------------------
> >
> > >
> >
> > >
> >
> > >
> >
> > > 'Open the Connection -------------------------------------
> >
> > >
> >
> > > Dim objConn As OleDbConnection
> >
> > >
> >
> > > Dim objConnString As String =
> >
> > > "Provider=Microsoft.Jet.OLEDB.4.0;Data
> >
> > > Source=" & Server.MapPath("~/DB/belcherman.mdb")
> >
> > >
> >
> > > objConn = New OleDb.OleDbConnection(objConnString)
> >
> > >
> >
> > > '---------------------------------------------------------
> >
> > >
> >
> > >
> >
> > >
> >
> > > 'Build SQL String --------------------------------------
> >
> > >
> >
> > > Dim strSQLstring As String
> >
> > >
> >
> > > Dim objDataTable As DataTable
> >
> > >
> >
> > >
> >
> > >
> >
> > > strSQLstring = "UPDATE tblBTC ([Name], [Playingname],
> > [Password],
> >
> > > [Location], [Email], [Age], [icq], [aim], [Occupation], [bio], " & _
> >
> > >
> >
> > > "[PersonalInformation], [GamesPlayed], [Connect],
> >
> > > [Processor], [Ram], " & _
> >
> > >
> >
> > > "[videocard], [soundcard], [harddrive],
> >
> > > [additionalsysteminformation], " & _
> >
> > >
> >
> > > "[Photo], [UserName], [DateJoined], [OS],
> >
> > > [SystemPhoto])
> >
> > > " & _
> >
> > >
> >
> > > "VALUES (@Name, @Playingname, @Password,
> @Location,
> >
> > > @Email, @Age, @Icq, @Aim, @Occupation, @Bio, @PersonalInformation,
> >
> > > @GamesPlayed, @Connect, @Processor, @Ram, @Videocard, @Soundcard,
> >
> > > @Harddrive, @Additionalsysteminformation, @Photo, @UserName,
> > @DateJoined,
> >
> > > @OS, @SystemPhoto) " & _
> >
> > >
> >
> > > "WHERE [Username] = '" & strUsernameWeb & "'"
> >
> > >
> >
> > >
> >
> > >
> >
> > > Dim sqlcmd As OleDbCommand = New OleDbCommand(strSQLstring,
> >
> > > objConn)
> >
> > >
> >
> > >
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@Name", OleDbType.VarChar, 150).Value
> =
> >
> > > name.Text
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@Playingame", OleDbType.VarChar,
> > 150).Value
> >
> > > =
> >
> > > playingname.Text
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@Password", OleDbType.VarChar,
> 150).Value
> > =
> >
> > > Password.Text
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@Location", OleDbType.VarChar,
> 150).Value
> > =
> >
> > > location.Text
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@Email", OleDbType.VarChar, 150).Value
> =
> >
> > > email.Text
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@Age", OleDbType.VarChar, 150).Value =
> >
> > > age.Text
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@Icq", OleDbType.VarChar, 150).Value =
> >
> > > icq.Text
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@Aim", OleDbType.VarChar, 150).Value =
> >
> > > aim.Text
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@Occupation", OleDbType.VarChar,
> > 150).Value
> >
> > > =
> >
> > > occupation.Text
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@Bio", OleDbType.LongVarChar).Value =
> >
> > > bio.Text
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@PersonalInformation",
> >
> > > OleDbType.LongVarChar).Value = personalinformation.Text
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@GamesPlayed",
> > OleDbType.LongVarChar).Value
> >
> > > =
> >
> > > gamesplayed.Text
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@Connect", OleDbType.VarChar,
> 150).Value
> > =
> >
> > > connect.SelectedValue
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@Processor", OleDbType.VarChar,
> > 150).Value
> > =
> >
> > > processor.Text
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@Ram", OleDbType.VarChar, 150).Value =
> >
> > > ram.Text
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@VideoCard", OleDbType.VarChar,
> > 150).Value
> > =
> >
> > > videocard.Text
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@SoundCard", OleDbType.VarChar,
> > 150).Value
> > =
> >
> > > soundcard.Text
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@HardDrive", OleDbType.VarChar,
> > 150).Value
> > =
> >
> > > harddrive.Text
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@Additionalsysteminformation",
> >
> > > OleDbType.LongVarChar).Value = additionalsysteminformation.Text
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@Photo", OleDbType.VarChar, 150).Value
> =
> >
> > > Photo.Text
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@UserName", OleDbType.VarChar,
> 150).Value
> > =
> >
> > > Username.Text
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@DateJoined", OleDbType.VarChar,
> > 150).Value
> >
> > > =
> >
> > > DateTime.Now().ToShortDateString()
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@OS", OleDbType.VarChar, 150).Value =
> >
> > > OS.SelectedValue
> >
> > >
> >
> > > sqlcmd.Parameters.Add("@SystemPhoto", OleDbType.VarChar,
> > 150).Value
> >
> > > = SystemPhoto.Text
> >
> > >
> >
> > >
> >
> > >
> >
> > > 'Response.Write(strSQLstring)
> >
> > >
> >
> > >
> >
> > >
> >
> > > Try
> >
> > >
> >
> > > objConn.Open()
> >
> > >
> >
> > > sqlcmd.ExecuteNonQuery()
> >
> > >
> >
> > > Finally
> >
> > >
> >
> > > 'Show Completed Profile
> >
> > >
> >
> > > objConn.Dispose()
> >
> > >
> >
> > > End Try
> >
> > >
> >
> > >
> >
> > >
> >
> > > BindNewMember(Username.Text)
> >
> > >
> >
> > > BTCpassPanel.Visible = False 'Hide logon as they have done
> > that.
> >
> > >
> >
> > > BTCEditPanel.Visible = False 'Hide edit form
> >
> > >
> >
> > > BTCcompletePanel.Visible = True 'Show completed edited
> profile
> >
> > >
> >
> > >
> >
> > >
> >
> > > End Sub
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > > [Non-text portions of this message have been removed]
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > > ________________________________
> >
> > > Yahoo! Groups Links
> >
> > >
> >
> > > To visit your group on the web, go to:
> >
> > > http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
> >
> > >
> >
> > > To unsubscribe from this group, send an email to:
> >
> > > [EMAIL PROTECTED]
> >
> > >
> >
> > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
> >
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> > http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
> >
> >
> >
> > [EMAIL PROTECTED]
> >
> >
> >
> > http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> > ________________________________
> > Yahoo! Groups Links
> >
> > To visit your group on the web, go to:
> > http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
> >
> > To unsubscribe from this group, send an email to:
> > [EMAIL PROTECTED]
> >
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>
>
> ________________________________
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
>
> To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/