views:

59

answers:

2

Please help this would be my last problem in dealing with access database with vb.net if you could help me solve this. I'm trying to update ms access data using vb.net and here's my code:

updateuserclass.vb

Public Class UpdateUser

    Dim bankai As New Updater


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        bankai.unum = TextBox1.Text
        bankai.username = TextBox4.Text
        bankai.password = TextBox3.Text



        bankai.updates()
        MsgBox("Successfully updated!")
    End Sub

And here's the code in the form which tries to update the data:

Dim bankai As New Updater



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    bankai.unum = TextBox1.Text
    bankai.username = TextBox4.Text
    bankai.password = TextBox3.Text



    bankai.updates()
    MsgBox("Successfully updated!")



End Sub

What might be wrong in here?I set it all to string, is the primary key usernum not a string. What do I do, please help thanks.

A: 

What type is 'bankai.unum' ?

Maybe you have to convert it to an integer.

Rhapsody
I figured it out, but will I have problems if I set the auto number to a text in ms access?The unum is an auto number will I have problems in adding?
Do not update autonumbers, Access does this for you. If you want to update, use something other than autonumber.
Remou
Do not even *try* to update Autonumbers -- it's a recipe for frustration as they are updatable once the record is created. You *can* specify a value for the Autonumber field in a SQL APPEND, but it has to not collide with existing values (assuming a UNIQUE index). Jet/ACE Autonumber is really a long integer field with a special kind of default value and a few other special properties (i.e., can't be changed once the record is created). Thinking of it as a default value makes it easier to understand why you can append a value to it.
David-W-Fenton
A: 

If bankai.unum is an integer, you might need:

bankai.unum = CInt(TextBox1.Text)

but without the update code and the table schema it's a bit hard to tell.

mavnn