Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
Password Reminder
Register
| FAQ | Members List | Calendar | 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 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 April 28th, 2008, 09:54 AM
Registered User
 
Join Date: Feb 2008
Location: , , .
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


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

            connDB.closeConn()
            connDB.openConn()

            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 & "'"

            da.SelectCommand.ExecuteNonQuery()

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

            connDB.closeConn()
        Catch ex As OleDb.OleDbException
            MessageBox.Show(ex.Message)
        End Try
    End Sub


Reply With Quote
  #2 (permalink)  
Old June 5th, 2008, 07:22 AM
Authorized User
 
Join Date: May 2008
Location: BELFAST, , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote
  #3 (permalink)  
Old June 5th, 2008, 01:38 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

I believe you need to add a space here:
Code:
    " 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?
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
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



All times are GMT -4. The time now is 04:03 PM.


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