Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
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 April 28th, 2008, 09:54 AM
Registered User
Join Date: Feb 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Overflow Problem in ToolStrip Save button

Hello Sir,

I've a form that contains a tool strip and Data grid view,
I want to update changes upon click on the Save button in the tool strip. I've written the code below and it was work properly when I placed it inside a button, but when I place indside the SaveToolStripButton it was working..I think this is a problem of overflow in tool strip so plz provide me by your help as soon as possible.

Please find out the code below for the situation above:

Private Sub SaveToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripButton.Click

            Dim connDB As New OleDbAddressBookClass
            Dim da As New OleDbDataAdapter
            Dim ds As New DataSet


            da.SelectCommand = New OleDbCommand
            da.SelectCommand.Connection = connDB.getConn
            da.SelectCommand.CommandType = CommandType.Text
            da.SelectCommand.CommandText = "Update Book Set" & _
                                         " Address = '" & ABGV.CurrentRow.Cells(2).Value & "'" & _
                                         "Where PID = '" & ABGV.CurrentRow.Cells(0).Value & "'"


            MessageBox.Show("Operation Succeed", "System Track", _
            MessageBoxButtons.OK, MessageBoxIcon.Information)

        Catch ex As OleDb.OleDbException
        End Try
    End Sub

Old June 5th, 2008, 07:22 AM
Authorized User
Join Date: May 2008
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts

Don't know if this helps but have you considered having two procedures one for saving new data and the other for updating exsiting data??? I have just done a program using both methods and by keeping track of wither or not it is a new record you should be able to code the savetoolstripbutton to recognise the difference and do which is required

Old June 5th, 2008, 01:38 PM
Friend of Wrox
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts

I believe you need to add a space here:
    " Address = '" & ABGV.CurrentRow.Cells(2).Value & "'" & _
    "Where PID = '" & ABGV.CurrentRow.Cells(0).Value & "'"
    just before the Where...

You say “I think this is a problem of overflow in tool strip...” which sounds like you have some doubt.

Do you receive an error message? What is it?
Which line throws the error?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Save button riaz Java GUI 1 April 16th, 2007 11:44 PM
avoid getting save confirmation on button click sansircar .NET Framework 1.x 1 February 1st, 2006 12:52 AM
arithmetic overflow problem flyfish SQL Server 2000 4 July 12th, 2005 04:37 PM
how to show a button when save is done noor ASP.NET 1.0 and 1.1 Basics 4 May 9th, 2005 12:49 AM
onclick button, we want to save our company profil pawan Javascript 3 September 26th, 2003 07:04 AM

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