Re: Object in session question
From: Chris (Chris_at_discussions.microsoft.com)
Date: 02/03/05
- Next message: Kevin Spencer: "Re: Reference html file from an aspx file"
- Previous message: Edward: "PreRender code seems to cause Javascript error!"
- In reply to: Karl Seguin: "Re: Object in session question"
- Next in thread: Kevin Spencer: "Re: Object in session question"
- Reply: Kevin Spencer: "Re: Object in session question"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 3 Feb 2005 07:25:02 -0800
Well I have always used session values but have kept it to a select few. I
see in this app dozens upon dozens to control things as simple as a report
name on a single page. Setting and using them as <> "" and = "". Then I
thought that simple datagrid population could be improved using functions,
etc. but to pass the SQL statement around, etc. seemed over kill? I could be
wrong. And there is a view and SP for each activity, most occuring once (not
reused again in the app).
On a separate subject, I've been reading about keeping the logic in the
business layer and not using SP's. I wonder what the true loss in eff is?
Thanx everyone for the input. We learn something new everyday.
"Karl Seguin" wrote:
> Chris,
> Perhaps I misunderstood, but what do you see as the problem? Simply the use
> of sessions? You said "isn't he putting a page into a session object?" not
> sure what you mean by this, but no he isn't. He doesn't do
> Session("CurrentPage") = Page ....
>
> Sessions are bad only when used incorrectly. You haven't given us quite
> enough scope to really pass judgement...I would guess that a lot of this
> could probably be rewritten without sessions...and probably be better for it
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> "Chris" <Chris@discussions.microsoft.com> wrote in message
> news:9E66F345-D9A1-4FB6-B803-E639ECC5A648@microsoft.com...
> > I'm on a project where the prevoius developer wrote code like below. I
> > thought stuff like this was bad? Isn't he putting a page into a session
> > object? And what we are trying to do is hit the db via a Stored Proc to
> > create a datatable in most cases. This seems like a waste to me. Is this
> good?
> >
> > Public Shared Function getSQL(ByRef thePage As Page) As
> ProjectName.SQLServer
> >
> > If thePage.Session("mySQLInit") = "1" Then
> >
> > Return thePage.Session("mySQL")
> > End If
> >
> > thePage.Session("mySQL") = New ProjectName.SQLServer
> > thePage.Session("mySQLInit") = "1"
> >
> > Return thePage.Session("mySQL")
> > End Function
> >
> > And then shoots to the SP to create datatable:
> >
> > Sub FillDataGrid(ByRef gridData As System.Web.UI.WebControls.DataGrid,
> ByVal
> > SQL As String, Optional ByVal bAddNew As Boolean = False)
> >
> > Dim cnn As SqlConnection = New
> >
> SqlConnection(ConfigurationSettings.AppSettings().Item("ConnectionString"))
> >
> > Dim dt As DataTable = New DataTable("")
> > Dim dr As DataRow
> >
> > Dim objDA As SqlClient.SqlDataAdapter
> > objDA = New SqlClient.SqlDataAdapter
> >
> > dt = ExecSQLReturnDT(SQL, objDA)
> >
> > If bAddNew Then
> > dr = dt.NewRow
> > dt.Rows.InsertAt(dr, 0)
> > gridData.EditItemIndex = 0
> > End If
> >
> > gridData.DataSource = dt
> > gridData.DataBind()
> >
> > End Sub
> >
> > And I see dozens of this:
> >
> > page.Page.Session("psedit_PSHistoryID") = ""
> >
> >
> >
>
>
>
- Next message: Kevin Spencer: "Re: Reference html file from an aspx file"
- Previous message: Edward: "PreRender code seems to cause Javascript error!"
- In reply to: Karl Seguin: "Re: Object in session question"
- Next in thread: Kevin Spencer: "Re: Object in session question"
- Reply: Kevin Spencer: "Re: Object in session question"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|