-
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.
-
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...