473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Overflow error in access databse handling

hi every one. pls i am recieving this overflow error when i try to insert values into an access database. its really freaking me out. i have tried several approaches but to no avail. i would be very grateful if anyone can help me through this. here is my code below:

Expand|Select|Wrap|Line Numbers
  1.        admisnNumber = Val(TxtAdNumber.Text)
  2.         childnames = Trim(TxtboxName.Text)
  3.         fadazName = Trim(TxtboxFadasName.Text)
  4.         fadazphoneNo = Val(TxtboxFatherContact.Text)
  5.         modazname = Trim(TxtboxMothersName.Text)
  6.         modazphoneNo = Val(TxtboxMothersContact.Text)
  7.         EM1 = Val(txtboxEMcontact1.Text)
  8.         healthstate = txtboxHealth.Text
  9.         DOB = DOBPicker.Value
  10.  
  11.         Dim cmd As New OleDbCommand
  12.         If Not link.State = ConnectionState.Open Then
  13.             link.Open()
  14.         End If
  15.         cmd.Connection = link
  16.         cmd.CommandText = "INSERT INTO Children([StudentID], [Name], [DOB], [Sex], [Health], [Address] , [ParentID]) " & _
  17.                         " VALUES(' " & admisnNumber & " ','" & childnames & "','" & DOB & "','" & sex & "','" & healthstate & "','" & address & "','" & admisnNumber & " ') "
  18.         cmd.ExecuteNonQuery()
  19.         Dim cmd2 As New OleDbCommand
  20.         cmd2.CommandText = "INSERT INTO Parents( [NameFather], [NameMother], [ContactMother], [ContactFather], [ContactEmergency]) " & _
  21.             " VALUES ('" & fadazName & "','" & modazname & "','" & CLng(modazphoneNo) & "','" & CLng(fadazphoneNo) & "','" & CLng(EM1) & "' )"
  22.         cmd2.Connection = link
  23.         cmd2.ExecuteNonQuery()' THE ERROR USUALLY APPEARS HERE
  24.         link.Close()
  25.         MsgBox("STUDENT DATA SUCCESSFUL ADDED TO DATABASE!")
Apr 21 '14 #1
2 1235
jimatqsi
1,271 Expert 1GB
pensnaku,
Welcome to bytes. As with most new posters it would be great if you would review the information here and apply it http://bytes.com/faq.php . Most importantly, use code tags. It freaks people out to see posts without code tags.

As for your problem, do the obvious. You're outputting a number of Long integers. Is the table defined appropriately? Are you putting longs into singles?

Get creative. Run the query manually as a select query. Review the data - does it look right? Remove individual columns from the output and try again until the problem doesn't happen. Then you've identified the column causing the problem.

Think! Get creative.

Jim
Apr 21 '14 #2
zmbd
5,501 Expert Mod 4TB
---
By, simply stating that your code "doesn't work," along with posting code that appears to have had very little if any troubleshooting performed, and expecting someone to help doesn't usually result in much of an answer and may result in your thread being deleted. Instead, please tell us what you were expecting to happen, what actually happened.

For any errors: for each error; the EXACT title, error number, and descriptions that occurred and at what line in your posted code the error occurred.

These are the minimum requirements for posting a question of this nature.
---

Another thing you should get used to is declaring your variables (DIM statements) at the beginning of your code not hodgepodge as you go as you are currently... it will make maintaining your code much easier for both yourself and anyone that follows.
Apr 21 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Mike | last post by:
I am trying to use the bulk insert command but I am getting the following error: ---Begin Error Msg--- Server: Msg 4867, Level 16, State 1, Line 1 Bulk insert data conversion error (overflow)...
2
by: Robert McEuen | last post by:
Using Access 97, Windows XP I'm receiving a Numeric Field Overflow error during text import that I did not receive before I split my database. Another thread I found suggested that the cause of...
7
by: MLH | last post by:
?2944*24 gives me an overflow error, entered in the immediate window. Anybody else?
7
by: Dan | last post by:
Hi. I'm having a problem with searching a databse entry. I'm new to dotnet and still trying to figure some things out. In order to locate a row in an access databse file .mdb, i am using this...
4
by: vir | last post by:
we use an E-office application where server is SQL server 7.0 and client side its MS access In our VB program we use ASP to synchronization and update client database from server and each table...
3
by: MLH | last post by:
A wide comma delimited text file import into A97 failed with an overflow error. I'm estimating it to have been no more than 1000 records. 100% of all the fields were quoted strings or ZLS's. ...
3
by: Bgreer5050 | last post by:
I can use a form view, gridview and details view to see the data in my access databse, but i cannot edit or add to the database. What simple step am I missing?
1
by: AngieMP | last post by:
Hi Guys I have inherited an Access DB in a very poorly state! I have offered to make some changes to it for a local charity but have got stuck on this error it seems to be creating for all new...
2
by: AngieMP | last post by:
Hi Guys I have inherited an Access DB in a very poorly state! I have offered to make some changes to it for a local charity but have got stuck on this error it seems to be creating for all new...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.