Click here to Skip to main content
15,889,867 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
here is my screenshot of the error

Photo - Google+[^]

What I have tried:

here is my code snippet of the current form

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If TextBox1.Text & TextBox2.Text & TextBox3.Text & TextBox4.Text & TextBox5.Text & TextBox6.Text & TextBox7.Text = Nothing Then
            MsgBox("Please fill up all information.")
            TextBox1.Clear()
            TextBox2.Clear()
            TextBox3.Clear()
            TextBox4.Clear()
            TextBox5.Clear()
            TextBox6.Clear()
            TextBox7.Clear()
        Else
            Try
                Dim myConnection As OleDbConnection
                myConnection = New OleDbConnection("Provider=Microsoft.JET.OLEDB.4.0;Data Source=G:\Sem7 (Final Project)\Bookstore POS System\possys.mdb;Persist Security Info=false;")
                Dim myCommand As OleDbCommand
                myCommand = New OleDbCommand("INSERT INTO customer([ID],[c_name],[email],[phone],[nric],[sex],[race]) VALUES (@ID, @c_name, @email, @phone, @nric, @sex, @race)", myConnection)
                Dim id As New OleDbParameter("@ID", OleDbType.VarChar)
                Dim name As New OleDbParameter("@c_name", OleDbType.VarChar)
                Dim email As New OleDbParameter("@email", OleDbType.VarChar)
                Dim phone As New OleDbParameter("@phone", OleDbType.VarChar)
                Dim nric As New OleDbParameter("@nric", OleDbType.VarChar)
                Dim sex As New OleDbParameter("@sex", OleDbType.VarChar)
                Dim race As New OleDbParameter("@race", OleDbType.VarChar)
                id.Value = TextBox1.Text
                name.Value = TextBox2.Text
                email.Value = TextBox3.Text
                phone.Value = TextBox4.Text
                nric.Value = TextBox5.Text
                sex.Value = TextBox6.Text
                race.Value = TextBox7.Text
                myCommand.Parameters.Add(id)
                myCommand.Parameters.Add(name)
                myCommand.Parameters.Add(email)
                myCommand.Parameters.Add(phone)
                myCommand.Parameters.Add(nric)
                myCommand.Parameters.Add(sex)
                myCommand.Parameters.Add(race)
                myCommand.Connection.Open()
                myCommand.ExecuteNonQuery()
                myCommand.Dispose()
                MsgBox("Account Created", MsgBoxStyle.Information, "Registered!")
                myConnection.Close()
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try
        End If
    End Sub
Posted
Updated 21-Jun-18 5:34am

1 solution

Overflow errors are caused when you try to insert/update a numeric value to something outside of that data-types range.
Without knowing the schema of your table as well as the data being inserted, it is hard to answer. Provide that information and I can update the answer.
 
Share this answer
 
Comments
Member 13881755 21-Jun-18 11:44am    
here is my table:

https://plus.google.com/u/0/photos/105084221205446686540/album/6569563113308797841/6569563115385410338?authkey=CKnZg_2MlMS0UA

https://plus.google.com/u/0/photos/105084221205446686540/album/6569563113308797841/6569563113575197714?authkey=CKnZg_2MlMS0UA
MadMyche 21-Jun-18 12:22pm    
How about telling us what the Field-Size is for the ID column? Is it auto generated? Please no more images.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900