Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 16th, 2005, 06:47 AM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to RPG SEARCH
Default

Ok I worked it out!!! Went down to the library and borrowed a book (not done that in
a long time [=)]). By wrox Beginning Dynamic Website with ASP.NET Web Matrix...

I found in there the following code and put my own values into it...
<h6>

    Function GetDesignDetails(ByVal designId As Integer) As System.Data.DataSet
        Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\Inetpub\vhosts\davejenkins.co.uk\httpdoc s\admin\sitedb.mdb"
        Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString )

        Dim queryString As String = "SELECT [tblDesigns].[SiteUrl], [tblDesigns].[DesignId], [tblDesigns].[SiteLongDes"& _
"c], [tblDesigns].[SiteOwner], [tblDesigns].[SiteTech], [tblDesigns].[SiteImage],"& _
" [tblDesigns].[AltTag], [tblDesigns].[SiteCreated], [tblDesigns].[SiteThumb] FRO"& _
"M [tblDesigns] WHERE ([tblDesigns].[DesignId] = @DesignId)"
        Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand
        dbCommand.CommandText = queryString
        dbCommand.Connection = dbConnection

        Dim dbParam_designId As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
        dbParam_designId.ParameterName = "@DesignId"
        dbParam_designId.Value = designId
        dbParam_designId.DbType = System.Data.DbType.Int32
        dbCommand.Parameters.Add(dbParam_designId)

        Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter
        dataAdapter.SelectCommand = dbCommand
        Dim dataSet As System.Data.DataSet = New System.Data.DataSet
        dataAdapter.Fill(dataSet)

        Return dataSet
    End Function

 Sub Page_load()
        If Not Page.IsPostBack Then
        viewSite.DataSource = GetDesignDetails(Request.Querystring.Item("designI d"))
        viewSite.DataBind()
        End If
 End Sub
</h6>

Sorry if this sounds stupid, the above seems a lot simpler... why do it the other
way and is that the normal way of doing it?

Thanks


David Jenkins
-------------------------------------------------------------
Do you want to make extra money around your commitments?
Credit cards, bills, loans and a mortgage - all getting you down?
Is your pension going to be enough when you retire?
There is a solution visit http://www.1stmillion.co.uk
or call 01772 489521
 
Old April 16th, 2005, 10:23 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Either way is fine. It comes down to the way you build the query. The book's example uses a parameterized query which I'd recommend over the other method. Using parameterized queries give you a certainly level of safety that you don't get from building the whole query. Plus, it's usually easier to work with them when you lots of values you need to add to the command.

Glad you got it working.

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
using querystring melkin Classic ASP Basics 7 April 1st, 2008 09:07 AM
Querystring or not? myself Classic ASP Basics 4 July 4th, 2006 09:01 AM
querystring problem -Dman100- Classic ASP Professional 10 September 15th, 2004 09:33 PM
querystring in xslt Mack XSLT 1 January 16th, 2004 11:45 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.