473,569 Members | 2,879 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

overflow in C# (visual Studio) where tryingt oinsert in database

1 New Member
hello i am getting a overflow error when I try to run this:


here is the error:
Expand|Select|Wrap|Line Numbers
  1. System.Data.OleDb.OleDbException was unhandled
  2.   Message="Overflow"
  3.   Source="Microsoft JET Database Engine"
  4.   ErrorCode=-2147217833
  5.   StackTrace:
  6.        at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
  7.        at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
  8.        at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
  9.        at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
  10.        at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
  11.        at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
  12.        at WindowsApplication1.Form1.button1_Click(Object sender, EventArgs e) in C:\Documents and Settings\Brad\Desktop\WindowsApplication1\WindowsApplication1\Form1.cs:line 55
  13.        at System.Windows.Forms.Control.OnClick(EventArgs e)
  14.        at System.Windows.Forms.Button.OnClick(EventArgs e)
  15.        at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
  16.        at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
  17.        at System.Windows.Forms.Control.WndProc(Message& m)
  18.        at System.Windows.Forms.ButtonBase.WndProc(Message& m)
  19.        at System.Windows.Forms.Button.WndProc(Message& m)
  20.        at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
  21.        at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
  22.        at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  23.        at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
  24.        at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
  25.        at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
  26.        at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
  27.        at System.Windows.Forms.Application.Run(Form mainForm)
  28.        at WindowsApplication1.Program.Main() in C:\Documents and Settings\Brad\Desktop\WindowsApplication1\WindowsApplication1\Program.cs:line 17
  29.        at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
  30.        at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
  31.        at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
  32.        at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
  33.        at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
  34.        at System.Threading.ThreadHelper.ThreadStart()


here is the code:
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data.OleDb;
  5. using System.Configuration;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Text;
  9. using System.Windows.Forms;
  10.  
  11. namespace WindowsApplication1
  12. {
  13.  
  14.     public partial class Form1 : Form
  15.     {
  16.         public Form1()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.         private OleDbConnection connection;
  21.         private OleDbDataAdapter adapter;
  22.         private OleDbCommand command;
  23.  
  24.         private void Form1_Load(object sender, EventArgs e)
  25.         {
  26.  
  27.         }
  28.  
  29.         private void tabPage1_Click(object sender, EventArgs e)
  30.         {
  31.  
  32.         }
  33.  
  34.         private void ConnectToDB()
  35.         {
  36.             connection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" +
  37.                 "Data Source=" + @"C:\Documents and Settings\Brad\Desktop\WindowsApplication1\WindowsApplication1\CD DATABASE.mdb");
  38.             connection.Open();
  39.         }
  40.  
  41.         private void button1_Click(object sender, EventArgs e)
  42.         {
  43.             ConnectToDB();
  44.             OleDbCommand objCmd;
  45.             String strSQLCommand = "INSERT INTO CLIENT VALUES ('" + CLIENT_NUMBER.Text + "','" + CLIENT_LAST_NAME.Text + "','" + FIRST_NAME.Text + "','" + CLIENT_ADDRESS_1.Text + "','" + CLIENT_ADDRESS_2.Text + "','" + CITY.Text + "','" + STATE.Text + "','" + ZIP.Text + "','" + PHONE_NUMBER.Text + "','" + PREF_PAYMENT.Text + "','" + PREF_ACCOUNT.Text + "','" + MUSIC_TYPE.Text + "')";
  46.             objCmd = new OleDbCommand(strSQLCommand, connection);
  47.             objCmd.ExecuteNonQuery();
  48.             label4.Text = "Your Info has been Added";
  49.             CLIENT_NUMBER.Text = " ";
  50.             CLIENT_LAST_NAME.Text = " ";
  51.             CLIENT_FIRST_NAME.Text = " ";
  52.             CLIENT_ADDRESS_2.Text = " ";
  53.             CLIENT_ADDRESS_1.Text = " ";
  54.             CITY.Text = " ";
  55.             STATE.Text = " ";
  56.             ZIP.Text = " ";
  57.             PHONE_NUMBER.Text = " ";
  58.             PREF_PAYMENT.Text = " ";
  59.             PREF_ACCOUNT.Text = " ";
  60.             MUSIC_TYPE.Text = " ";
  61.         }
The Access database is Access 2003 and VS 2005 professional

-Brad
Dec 6 '09 #1
0 1491

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

Similar topics

5
8147
by: Codemonkey | last post by:
Hi, When I first installed Visual Studio 2003, I noticed I was getting the follow error when showing a form: A first chance exception of type 'System.ArithmeticException' occurred in system.drawing.dll Additional information: Overflow or underflow in the arithmetic operation It is being thrown on the line that attempts to add the...
11
6807
by: olle | last post by:
Hi everyone. I am an Access developer having worked with Access-dev. projects for many years on Sql server databases and Access. For the internet I have been using traditional asp. But now I have tried asp.net and this tool seemes great to me. Haven't tried Vb for Visual Studio net, but hope to do that in the very future. Hope that this...
3
1366
by: Ralph Purtcher-Wydenbruck | last post by:
This is a worrying bug, and indicates a potential problem in the Framework CLR. This bug affected a project I was working on, which behaved differently when run from the Visual Studio IDE than when run by double clicking on the project's EXE file. The problem can be replicated easily: Create a new project in Visual Studio 2003 and add the...
18
9115
by: surfrat_ | last post by:
Hi, I am having the following problems in getting Microsoft Visual Studio 2005 Professional to link to an Access .mdb database. Please help me to sort this out. Problem 1: The Microsoft page "How to: Connect to Data in an Access Database"
5
4581
by: Mike | last post by:
Hello All, Please, if anyone can point me to the problem, I'd sure appreciate it! I am very new to VB programming and not a programmer to begin with. This is part of a Visual Basic 2005 Express Edition program to control a remote basketball scoreboard display unit. All I'm trying to do is add 5 byte variables and store the result in an...
3
6047
by: Edwin Smith | last post by:
I have a 2 form project in VS2005 that now hangs whenever I try to do anything with the second form. This seems to have started when I added some SQL tables from a Pervasive v.9 database using the Pervasive ODBC driver. The devenv.exe process hangs and will not respond with about 50% cpu usage and about 100 megs of memory used. I am...
1
19821
by: bharathreddy | last post by:
This Article gives an introduction to VSTS Team Foundation & fundamental difference between Visual Source Safe (VSS) and VSTS Team Foundation. Team Foundation is a set of tools and technologies that enable a team to collaborate and coordinate a project (software or non software projects). The team collaboration is achieved by several tools...
4
3143
by: Cindy H | last post by:
Hi I am currently using Visual Studio.Net 2003 running on Windows Server 2000 operating system. I have used Visual Studio.net 2003 connecting to Access 2002 databases in the pass with great success. Now, I have a need to go to Access 2007 which produces database.accdb file instead of database.mdb. I've used ole db Jet 4.0 to connect to...
0
1240
by: =?Utf-8?B?ZGF2aWQ=?= | last post by:
Last week I asked a question about connection to database from client machine (developer machine). There are two types of security setup for SQL Server database: Windows only and "SQL Server and Windows" under (local)Windows NT node of Enterprise Manager. ----- First, I set the database security as "SQL Server and Windows" under...
0
7703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7619
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7681
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6290
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5228
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.