Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases 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 July 10th, 2008, 01:11 PM
Registered User
 
Join Date: Jun 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default ListViewitem in VB.Net 2005

I am a student and I have school project to make a batabase using ms access and visual studio 2005 for school library.
When I typing (AEM is number)on the textbox and I press the the Button1 the listviewitem shows the records using access querin “usp_Select_Tmima_Pliroforikis_Danoismoi_FOI”

The problem is than when I click on the record shows listviewitem does not execute access query “usp_Select_Tmima_Pliroforikis_Danoismoi” because I must overload two fields to addparameter("@ARITHMOS_MHTROOY" and “BOOKS_ID”). When I use one fild it works perfectly. Well how can I overload two fields when listviewitem clicked.

Thanks in advansed!



'Here is the program
'Please help!



Public Class Dan_Pli
    Private intRowsAffected As Integer
    'Êïõìðß ãéá ôçí áíáæÞôçóç ôùí äáíåéóìþí óôïí ðéíáêá ðëçñïöïñéêÞ ìå ôï åñþôçìá usp_Select_Tmima_Pliroforikis_Danoismoi_FOI
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        'Declare variables
        Dim objListViewItem As ListViewItem

        'Initialize a new instance of the data access base class
        Using objData As New WDABase
            Try
                'Get all projects in a DataReader object
                objData.SQL = "usp_Select_Tmima_Pliroforikis_Danoismoi_FOI"
                objData.InitializeCommand()

                objData.AddParameter("@ARITHMOS_MHTROOY", _
                Data.OleDb.OleDbType.Integer, 32, CType(txtFoitPliAEM_Anaz_Dan.Text, Integer))


                objData.OpenConnection()
                objData.DataReader = objData.Command.ExecuteReader
                'See if any data exists before continuing
                If objData.DataReader.HasRows Then
                    'Clear previous list
                    lvwDANPLI.Items.Clear()
                    'Process all rows
                    While objData.DataReader.Read()
                        'Create a new ListViewItem
                        objListViewItem = New ListViewItem
                        'Add the data to the ListViewItem
                        objListViewItem.Text = _
                        objData.DataReader.Item("ARITHMOS_MHTROOY")

                        objListViewItem.Tag = objData.DataReader.Item("ARITHMOS_MHTROOY")
                        objListViewItem.Tag = objData.DataReader.Item("BOOK_ID")
                        'Add the sub items to the listview item

                        objListViewItem.SubItems.Add( _
                        objData.DataReader.Item("EPONYMO"))
                        objListViewItem.SubItems.Add( _
                        objData.DataReader.Item("ONOMA"))


                        objListViewItem.SubItems.Add( _
                        objData.DataReader.Item("BOOK_ID"))



                        objListViewItem.SubItems.Add( _
                        objData.DataReader.Item("TITLOS"))


                        objListViewItem.SubItems.Add( _
                        objData.DataReader.Item("ISBN"))

                        objListViewItem.SubItems.Add( _
                        objData.DataReader.Item("KATHGORIA"))

                        objListViewItem.SubItems.Add( _
                        objData.DataReader.Item("SYGGRAFEAS"))

                        objListViewItem.SubItems.Add( _
                        objData.DataReader.Item("EKDOTHS"))


                        objListViewItem.SubItems.Add( _
                        Format(objData.DataReader.Item("HMER_DANEISMOY"), "g"))

                        objListViewItem.SubItems.Add( _
                        objData.DataReader.Item("HMER_EPISTROFHS"))

                        'Add the ListViewItem to the ListView control
                        lvwDANPLI.Items.Add(objListViewItem)
                    End While
                End If
                objData.DataReader.Close()
            Catch ExceptionErr As Exception
                MessageBox.Show(ExceptionErr.Message) ', strAppTitle)
            End Try
        End Using
        'Cleanup
        objListViewItem = Nothing
    End Sub


    'ÊÜíïíôáò êëéê óå ìéá åããñáöÞ ìáò åìöáíßæåé ôéò ðëçñïöïñßåò ìÝóù ôïõ åñùôÞìáôïò usp_Select_Tmima_Pliroforikis_Danoismoi
    '÷ñçóéìïðïéüíôáò ôï ðåäßï ÁÑÉÈÌÏÓ ÌÇÔÑ¿ÏÕ KAI TO ÐÅÄÉÏ ÂÏÏÊ_ÉD
    Private Sub lvwDANPLI_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lvwDANPLI.Click
        'Initialize a new instance of the data access base class
        Using objData As New WDABase
            Try
                'Get the specific project selected in the ListView control
                objData.SQL = "usp_Select_Tmima_Pliroforikis_Danoismoi"
                objData.InitializeCommand()


                objData.AddParameter("@ARITHMOS_MHTROOY", Data.OleDb.OleDbType.Integer, 32, _
                lvwDANPLI.SelectedItems.Item(0).Tag)

                objData.AddParameter("@BOOK_ID", Data.OleDb.OleDbType.Integer, 32, _
                lvwDANPLI.SelectedItems.Item(0).Tag)




                'Data.OleDb.OleDbType.Guid, 16, _
                objData.OpenConnection()
                objData.DataReader = objData.Command.ExecuteReader
                'See if any data exists before continuing
                If objData.DataReader.HasRows Then
                    'Read the first and only row of data
                    objData.DataReader.Read()
                    'Populate the Project Details section

                    txtFoiPliArithmosMhtrooyD.Text = _
                    objData.DataReader.Item("ARITHMOS_MHTROOY") '.ToString.ToUpper()


                    txtFoiPliEponymoD.Text = _
                    objData.DataReader.Item("EPONYMO")

                    txtFoiPliOnomaD.Text = _
                    objData.DataReader.Item("ONOMA")


                    txtFoiPliTmhmaD.Text = _
                    objData.DataReader.Item("BOOK_ID")


                    txtFoiPliHmer_GennhshsD.Text = _
                    objData.DataReader.Item("TITLOS")

                    txtFoiPliDieythynsiD.Text = _
                    objData.DataReader.Item("ISBN")

                    txtFoiPliPolhD.Text = _
                    objData.DataReader.Item("KATHGORIA")

                    txtFoitPliTkD.Text = _
                    objData.DataReader.Item("SYGGRAFEAS")

                    txtFoiPliEtosEisagogisD.Text = _
                    objData.DataReader.Item("EKDOTHS")


                    txtFoiPliHmer_TropopoiisisD.Text = _
                    Format(objData.DataReader.Item("HMER_DANEISMOY"), "g")

                    txtFoiPliEmailD.Text = _
                    objData.DataReader.Item("HMER_EPISTROFHS")

                End If
                objData.DataReader.Close()
            Catch ExceptionErr As Exception
                MessageBox.Show(ExceptionErr.Message) ', strAppTitle)
            End Try
        End Using
    End Sub


End Class







 
Old July 10th, 2008, 01:56 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Wrong forum.

This is *CLASSIC* ASP. As in "ASP before ASP.NET existed."

You want an ASP.NET answer.
 
Old July 11th, 2008, 02:09 PM
Registered User
 
Join Date: Jun 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry






Similar Threads
Thread Thread Starter Forum Replies Last Post
Vb.Net 2005 and listviewitem problem johnnys14 ADO.NET 0 July 10th, 2008 01:18 PM
reg conn to sql server 2005 from vb.net 2005.. veda SQL Server 2005 2 July 1st, 2008 12:16 AM
Can I run VB .net 2005 with DOT NET 2003 APPLICATI kadesskade BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 2 August 8th, 2006 05:14 AM
send MASS Emails in ASP.NET 2 with VB.NET 2005 alexdcosta ASP.NET 2.0 Basics 1 July 17th, 2006 12:31 AM
Should I go VB.NET or VB 2005 from VB6? HB Visual Studio 2005 1 December 9th, 2005 03:13 AM





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