Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
| Search | Today's Posts | Mark Forums Read
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics 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 December 28th, 2006, 01:45 AM
Authorized User
 
Join Date: Dec 2006
Location: Tucson, AZ, USA.
Posts: 43
Thanks: 4
Thanked 0 Times in 0 Posts
Send a message via MSN to Yasho
Default updating the table from the list view columns

I have written a program, which in response to user input, populates the data in a list view (msaccess table) Now I need to extract the data from list view and update a different table. Updating the table is not working. Can some one help this ignorent ?

Here is the code
  Dim mySearchString As String
        Dim SearchName As String
        SearchName = txtMovieID.Text

        if txtPerson.Text = "" then
MessageBox.Show("Please First select the perosn who is renting movies")
Else
    If Not IsNumeric(SearchName) Then
 MessageBox.Show(" Plese type The movie Name Correctly", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand)
 Else
  mySearchString = "Select Number,Title,DaysToRent,RentalRate, Status from tblInventory where number=" & txtMovieID.Text
  DsRental2.Clear()
  daRental.SelectCommand.CommandText = mySearchString
  daRental.Fill(DsRental2)
   If DsRental2.tblInventory.Count = 0 Then
MessageBox.Show(" Movie by " & SearchName & " doesnot exist", "Search Result")
     Else
     Try
      With lvwRental
      Dim Item As ListViewItem
Item = New ListViewItem(txtMovieID.Text)
      Item.SubItems.Add(DsRental2.tblInventory(0).Title)
      Item.SubItems.Add(Today)
      Item.SubItems.Add(Today.AddDays(txtDaysToRent.Text ))
      Item.SubItems.Add(FormatCurrency(txtRentalRate.Tex t))
      Item.SubItems.Add(FormatCurrency(txtRentalRate.Tex t))
      lvwRental.Items.Add(Item)
      txtMovieID.Clear()
  End With
  Catch except As Exception
  MessageBox.Show(except.Message, except.GetType.ToString())
  End Try

End If
  End If
    End If
Dim newRow As dsTransection.tblRentalRow
                Dim Item As ListViewItem
                Dim result As String

                Try

                    newRow = DsTransection1.tblRental.NewRow()
                    newRow("CustomerID") = txtCustID.Text
                    newRow("MovieID") = lvwRental.Columns(Val("MovieID"))
                    newRow("DateRented") = Today
                    newRow("Datedue") = lvwRental.Columns("DateDue")

result = (MessageBox.Show("Do You Want to record transection Now", "", MessageBoxButtons.YesNo, MessageBoxIcon.Stop))
If result = DialogResult.Yes Then

 DsTransection1.tblRental.Rows.Add(newRow)
 daTransection.Update(DsTransection1)

  End If
Catch ex As Exception
MessageBox.Show(ex.Message)
newRow.CancelEdit()
End Try




yvk
__________________
yvk
 
Old February 6th, 2007, 10:43 PM
Registered User
 
Join Date: Dec 2006
Location: Tucson, Az, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have solved the problem anyone interested to know email me at yasho@cometomypc.net


js
 
Old July 31st, 2007, 02:06 AM
Authorized User
 
Join Date: Jul 2006
Location: dera ismail khan, nwfp, Pakistan.
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to naveed77 Send a message via Yahoo to naveed77
Default

then y r u here ? everyone needs solution over here but u r trying to hide the solution. this is not humanity. mr.lovehead




Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Grid View Drop Down List, view all jskinner123 ASP.NET 2.0 Basics 0 November 25th, 2007 06:25 PM
updating individual columns kscase VB Databases Basics 11 May 10th, 2007 03:18 PM
Updating table from dropdown list GS ASP.NET 2.0 Professional 2 March 18th, 2007 07:22 AM
populate details view or list view non empty rows iinfoque ASP.NET 2.0 Basics 0 March 11th, 2007 06:11 AM
Populating list view columns Yasho Visual Basic 2005 Basics 1 December 21st, 2006 05:29 PM





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