Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
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 September 2nd, 2004, 05:05 AM
Registered User
 
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Product Details Page in ASP.NET?

Hi all,

new to ASP.NET and having read several ASP.NET sites, Im very confused! I'm a pretty competent ASP programmer but the move to ASP.NET has got my head spinning.

Im just trying to program page which displays details for a specific product.In classic ASP all I did was use a recordset which accessed a MS SQL SProc ans then write all the fields to variables.

Im having problems in ASP.NET doing the same thing (I code in VB). At the moment Im using a class like the following and just using labels around the ASPX page.

======== START OF CODE =========
Public Function GetBookDetails(ByVal ISBN As String) As BookDetails

            ' Create Instance of Connection and Command Object
            Dim objConn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("C onnectionString"))
            Dim objCmd As SqlCommand = New SqlCommand("sp_Book_Detail", objConn)

            ' Mark the Command as a SPROC
            objCmd.CommandType = CommandType.StoredProcedure

            ' Add Parameters to SPROC
            Dim parameterISBN As SqlParameter = New SqlParameter("@ISBN", SqlDbType.VarChar, 10)
            parameterISBN.Value = ISBN
            objCmd.Parameters.Add(parameterISBN)

            Dim parameterTitle As SqlParameter = New SqlParameter("@Title", SqlDbType.VarChar, 255)
            parameterTitle.Direction = ParameterDirection.Output
            objCmd.Parameters.Add(parameterTitle)

            Dim parameterSubTitle As SqlParameter = New SqlParameter("@SubTitle", SqlDbType.VarChar, 255)
            parameterSubTitle.Direction = ParameterDirection.Output
            objCmd.Parameters.Add(parameterSubTitle)

            Dim parameterAuthor As SqlParameter = New SqlParameter("@Author", SqlDbType.VarChar, 255)
            parameterAuthor.Direction = ParameterDirection.Output
            objCmd.Parameters.Add(parameterAuthor)

            Dim parameterPublicationDate As SqlParameter = New SqlParameter("@PublicationDate", SqlDbType.VarChar, 100)
            parameterPublicationDate.Direction = ParameterDirection.Output
            objCmd.Parameters.Add(parameterPublicationDate)

            Dim parameterDimensions As SqlParameter = New SqlParameter("@Dimensions", SqlDbType.VarChar, 10)
            parameterDimensions.Direction = ParameterDirection.Output
            objCmd.Parameters.Add(parameterDimensions)

            Dim parameterNoPages As SqlParameter = New SqlParameter("@NoPages", SqlDbType.VarChar, 100)
            parameterNoPages.Direction = ParameterDirection.Output
            objCmd.Parameters.Add(parameterNoPages)

            Dim parameterBinding As SqlParameter = New SqlParameter("@Binding", SqlDbType.VarChar, 100)
            parameterBinding.Direction = ParameterDirection.Output
            objCmd.Parameters.Add(parameterBinding)

            Dim parameterPrice As SqlParameter = New SqlParameter("@Price", SqlDbType.Money, 8)
            parameterPrice.Direction = ParameterDirection.Output
            objCmd.Parameters.Add(parameterPrice)

            Dim parameterDiscount As SqlParameter = New SqlParameter("@Discount", SqlDbType.Int, 4)
            parameterDiscount.Direction = ParameterDirection.Output
            objCmd.Parameters.Add(parameterDiscount)

            ' Open the connection and execute the Command
            objConn.Open()
            objCmd.ExecuteNonQuery()
            objConn.Close()

            ' Create and Populate BookDetails Struct using
            ' Output Params from the SPROC
            Dim objBookDetails As BookDetails = New BookDetails()

            objBookDetails.Title = CStr(parameterTitle.Value)
            objBookDetails.SubTitle = CStr(parameterSubTitle.Value)
            objBookDetails.Author = CStr(parameterAuthor.Value)
            objBookDetails.PublicationDate = CStr(parameterPublicationDate.Value)
            objBookDetails.Dimensions = CStr(parameterDimensions.Value)
            objBookDetails.NoPages = CStr(parameterNoPages.Value)
            objBookDetails.Binding = CStr(parameterBinding.Value)
            objBookDetails.Price = CType(parameterPrice.Value, Decimal)
            objBookDetails.Discount = CStr(parameterDiscount.Value)

            Return objBookDetails

        End Function
    End Class
======== END OF CODE =========

The problem with the above (using Input/Output parameters) is I cant access Ntext or Text fields in the database. How do I go about doing this? Anyone show me the correct syntax or point me to an article?

Thanks!
 
Old September 2nd, 2004, 07:38 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

http://support.microsoft.com/default...b;en-us;306636 This will tell u all.

HTH.

Always:),
Hovik Melkomian.
 
Old September 2nd, 2004, 07:55 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I got a page not found error message on the link.

 
Old September 2nd, 2004, 10:04 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

It should be:

http://support.microsoft.com/default...b;EN-US;301075

The one above is for C#.

J
 
Old September 3rd, 2004, 11:31 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

http://support.microsoft.com/default...b;en-us;306636
I dont know why its wrapped.

Always:),
Hovik Melkomian.





Similar Threads
Thread Thread Starter Forum Replies Last Post
access C#.Net page as action of calssic ASP page mansharma_s ASP.NET 1.x and 2.0 Application Design 6 January 7th, 2008 10:58 AM
how to deploying a product in vb.net bobwith5 .NET Framework 2.0 1 September 28th, 2007 02:17 AM
ASP.NET - Static Page and Dynamic Page sohrabus ASP.NET 2.0 Professional 2 April 18th, 2007 11:42 PM
Product Search ASP.NET (C#) with MS Access ayazhoda ASP.NET 2.0 Basics 3 April 5th, 2007 10:15 AM





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