Results 1 to 2 of 2

Thread: Update Database

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2003
    Posts
    38

    Update Database

    I am trying to create a feature to update a database. I have already used the INSERT data method to generate the code, but I am having trouble assigning code to a command button to update the database with a record using information supplied in text boxes. I currently have:

    Sub cmdAddRecord_Click(sender As Object, e As EventArgs)
    addRecord(txtAddDiscID.Text, txtAddArtist.Text, txtAddLabel.Text, txtAddRelease.Text, txtAddURL.Text)
    MXdatagrid1.datasource=showdata
    MXdatagrid1.databind
    End Sub

    in runtime it says that showdata is not defined. Can anybody tell me what showdata is referring to?

    Many thanks.

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    Not really! It could be a return value from the addRecord call - if this was addRecord method was coded as a function & returned a datareader or a dataset object for example you could alter the code like this:

    showdata = addRecord(txtAddDiscID.Text, txtAddArtist.Text, txtAddLabel.Text, txtAddRelease.Text, txtAddURL.Text)
    MXdatagrid1.datasource=showdata

    Apart from that I can't think of anything else this could be just from the code you have given. If this was copied from another project which I suspect it was, you could try & see if this showdata is a global (class-level) variable - declared right at the top of the class...

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width