Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 10th, 2008, 01:18 PM
Registered User
 
Join Date: Jun 2008
Location: kastoria, , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Vb.Net 2005 and listviewitem problem

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







Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem VB.NET 2005 - update data in Ms Access Netuser Pro Visual Basic 2005 0 August 1st, 2008 01:34 PM
ListViewitem in VB.Net 2005 johnnys14 Classic ASP Databases 2 July 11th, 2008 02:09 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
Should I go VB.NET or VB 2005 from VB6? HB Visual Studio 2005 1 December 9th, 2005 03:13 AM



All times are GMT -4. The time now is 12:54 PM.


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