473,748 Members | 8,530 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inserting into Access Database from C# ASP.

The field is too small to accept the amount of data you attempted to add. Try
inserting or pasting less data. Is the error I get when it get
dbCmd.ExecuteNo nQuery();. I have 15 fields to insert, therefore I did one
field at the time and found that the 13th field is the one causing the
problem, this field is in size 20 and data I am entering size is 1. I took
the INSERT command and entered it from Access Query and it worked, but not
from ASP page using C#. Please help I thank you for your assistance. I found
the similar error in
http://www.error-bank.com/microsoft....23_Thread.aspx. But there is no solutions posted.
Nov 21 '05 #1
9 6102
"Zak Milas" <Za******@discu ssions.microsof t.com> schrieb:
inserting or pasting less data. Is the error I get when it get
dbCmd.ExecuteNo nQuery();. I have 15 fields to insert, therefore I did one
field at the time and found that the 13th field is the one causing the


Notice that there is a separate group for .NET+database questions available:

<URL:news://news.microsoft. com/microsoft.publi c.dotnet.framew ork.adonet>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2
What does your update statement look like? Are you using Parameterized
query or dynamic SQL? You could have some illegal character if you're using
Dynamic SQL - that's the likely culprit.

--
W.G. Ryan, MVP

www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"Zak Milas" <Za******@discu ssions.microsof t.com> wrote in message
news:AB******** *************** ***********@mic rosoft.com...
The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. Is the error I get when it get
dbCmd.ExecuteNo nQuery();. I have 15 fields to insert, therefore I did one
field at the time and found that the 13th field is the one causing the
problem, this field is in size 20 and data I am entering size is 1. I took
the INSERT command and entered it from Access Query and it worked, but not
from ASP page using C#. Please help I thank you for your assistance. I found the similar error in

http://www.error-bank.com/microsoft....23_Thread.aspx. But there is no solutions posted.
Nov 21 '05 #3
I am using Parameterized Query; dbCmd.Parameter s.Add("@open_ca ll",
OleDbType.VarCh ar, 1).Value = intOpenCall; Where open_call in Access is
Yes/No field. And intOpenCall = 1.

"W.G. Ryan eMVP" wrote:
What does your update statement look like? Are you using Parameterized
query or dynamic SQL? You could have some illegal character if you're using
Dynamic SQL - that's the likely culprit.

--
W.G. Ryan, MVP


Nov 21 '05 #4
> >I am using Parameterized Query; dbCmd.Parameter s.Add("@open_ca ll",
OleDbType.VarCh ar, 1).Value = intOpenCall; Where open_call in Access is
Yes/No field. And intOpenCall = 1.
If "open_call" is Yes/No field shouldn't you be using OleDbType.Boole an?


Or possibly try setting it to -1. In Access, True = -1 and False = 0. If
the OP is thinking like a SQL Server BIT data type, he may be thinking 1 =
True, and Access will choke on that.
--
Peace & happy computing,

Mike Labosh, MCSD

"Mr. McKittrick, after very careful consideration, I have
come to the conclusion that this new system SUCKS!"
~~ General Barringer ~~
Nov 21 '05 #5
I have tried the -1 and this time I am getiing the error message:
(0x80040e57): Overflow

"Mike Labosh" wrote:
I am using Parameterized Query; dbCmd.Parameter s.Add("@open_ca ll",
OleDbType.VarCh ar, 1).Value = intOpenCall; Where open_call in Access is
Yes/No field. And intOpenCall = 1.

If "open_call" is Yes/No field shouldn't you be using OleDbType.Boole an?


Or possibly try setting it to -1. In Access, True = -1 and False = 0. If
the OP is thinking like a SQL Server BIT data type, he may be thinking 1 =
True, and Access will choke on that.
--
Peace & happy computing,

Mike Labosh, MCSD

"Mr. McKittrick, after very careful consideration, I have
come to the conclusion that this new system SUCKS!"
~~ General Barringer ~~

Nov 21 '05 #6
Why use an integer to begin with? Why not use True and False?

Greg

"Mike Labosh" <ml************ *@hotmail.com> wrote in message
news:uV******** ********@TK2MSF TNGP09.phx.gbl. ..
>I am using Parameterized Query; dbCmd.Parameter s.Add("@open_ca ll",
> OleDbType.VarCh ar, 1).Value = intOpenCall; Where open_call in Access is
> Yes/No field. And intOpenCall = 1.

If "open_call" is Yes/No field shouldn't you be using OleDbType.Boole an?


Or possibly try setting it to -1. In Access, True = -1 and False = 0. If
the OP is thinking like a SQL Server BIT data type, he may be thinking 1 =
True, and Access will choke on that.
--
Peace & happy computing,

Mike Labosh, MCSD

"Mr. McKittrick, after very careful consideration, I have
come to the conclusion that this new system SUCKS!"
~~ General Barringer ~~

Nov 21 '05 #7
I have tried the true/false as well and I get similar error; (0x80040e57):
Overflow
"Greg Burns" wrote:
Why use an integer to begin with? Why not use True and False?

Greg

"Mike Labosh" <ml************ *@hotmail.com> wrote in message
news:uV******** ********@TK2MSF TNGP09.phx.gbl. ..
>I am using Parameterized Query; dbCmd.Parameter s.Add("@open_ca ll",
> OleDbType.VarCh ar, 1).Value = intOpenCall; Where open_call in Access is
> Yes/No field. And intOpenCall = 1.

If "open_call" is Yes/No field shouldn't you be using OleDbType.Boole an?


Or possibly try setting it to -1. In Access, True = -1 and False = 0. If
the OP is thinking like a SQL Server BIT data type, he may be thinking 1 =
True, and Access will choke on that.
--
Peace & happy computing,

Mike Labosh, MCSD

"Mr. McKittrick, after very careful consideration, I have
come to the conclusion that this new system SUCKS!"
~~ General Barringer ~~


Nov 21 '05 #8
Post your code.

Remember OleDb parameters are referenced by POSITION not by name.

For example

INSERT INTO mytable (call_desc, open_call) VALUES (@call_desc, @open_call)

cmd.parameters. add("@open_call ", OleDbType.Boole an).value=bOpen Call
cmd.parameters. add("@call_desc ", OleDbType.varch ar,50).value=sD esc

This will fail.

Just my .02.

Greg
"Zak Milas" <Za******@discu ssions.microsof t.com> wrote in message
news:4C******** *************** ***********@mic rosoft.com...
I have tried the true/false as well and I get similar error; (0x80040e57):
Overflow
"Greg Burns" wrote:
Why use an integer to begin with? Why not use True and False?

Greg

"Mike Labosh" <ml************ *@hotmail.com> wrote in message
news:uV******** ********@TK2MSF TNGP09.phx.gbl. ..
>> >I am using Parameterized Query; dbCmd.Parameter s.Add("@open_ca ll",
>> > OleDbType.VarCh ar, 1).Value = intOpenCall; Where open_call in Access
>> > is
>> > Yes/No field. And intOpenCall = 1.
>
>> If "open_call" is Yes/No field shouldn't you be using
>> OleDbType.Boole an?
>
> Or possibly try setting it to -1. In Access, True = -1 and False = 0.
> If
> the OP is thinking like a SQL Server BIT data type, he may be thinking
> 1 =
> True, and Access will choke on that.
> --
> Peace & happy computing,
>
> Mike Labosh, MCSD
>
> "Mr. McKittrick, after very careful consideration, I have
> come to the conclusion that this new system SUCKS!"
> ~~ General Barringer ~~
>
>


Nov 21 '05 #9
You'll have been nothing but simply fabulous. Yes! the problem was
order/position of the OleDB Parameters. I trully appretiate for your input in
helping me. After two days of sweat, its finally done. Thank you from the
bottom of my heart.

"Greg Burns" wrote:
Post your code.

Remember OleDb parameters are referenced by POSITION not by name.

For example

INSERT INTO mytable (call_desc, open_call) VALUES (@call_desc, @open_call)

cmd.parameters. add("@open_call ", OleDbType.Boole an).value=bOpen Call
cmd.parameters. add("@call_desc ", OleDbType.varch ar,50).value=sD esc

This will fail.

Just my .02.

Greg


Nov 21 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
4071
by: Miranda | last post by:
Hi, I have a ASP/vbscript program that generates random passwords. The problem is I need to insert those passwords into an Access database of 327 clients. I have the random password program generating the 327 passwords, but have had no luck inserting them. =============================================== Here is the code that generates the passwords: =============================================== <% Option Explicit %>
7
3435
by: Jared Evans | last post by:
I developed a console application that will continually check a message queue to watch for any incoming data that needs to be inserted into MS SQL database. What would be a low-cost method I could use inside this console application to make sure the MS SQL database is operational before I perform the insert?
3
16519
by: James Alba | last post by:
Hey all, I am accessing an ms access database using .NET and C#. Like so, /* Create the database connection. */ connection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Name); connection.Open(); And all is good.
15
4109
by: yzlin04 | last post by:
Hello, I'm new in vb.net. I have a problem in inserting a new row to a MS Access database table. There is no error message comes out when i run my program, but when i check my MS Access table, there is no record inserted. So, i don't know which line is incorrect. Here is my code: Dim desc, itemID As String itemID = txtItemID.Text desc = txtItemDesc.Text
3
3367
by: Surya | last post by:
Dear All, I have problem on inserting a record to database..Although it looked easy.. i have caught up with following issue .. please go ahead and help me to find solution I Need to insert records to a data base,for which i am using Typed dataSet.(I used DataSet Designer to create one) Then created a table adapter in which i have written query for INSERT , & set Database Direct property to true.(I didnt use a seperate methods for...
20
3015
by: dav3 | last post by:
Alright folks I am in need of a lil guidance/assistance here. I have a program which reads in a txt file. This txt file contains lines of the form January 3, 2007, 85.8 Now each line of the txt file is to be read into my java program and then inserted (from the program into an Access Database). I am not exactly sure of where the problem lies. I know it has something to do with how I am parsing the file, or how I am passing my arguments to...
0
1655
by: SL Culby | last post by:
Hello everyone, I have a project where I pull SQL Server data put it into a dataset and now I have to put the dataset data into an Access Database. The dataset currently is over 2000 row, so looping through and inserting one row at a time is very expensive. Does anyone know a fast way with low overhead to accomplish this task. I have been working in this direction (code below) however the code inserts 0 rows into the access database. ...
2
1499
by: joeey | last post by:
I'm doing an online registration form and using ODBC to connect to my database. I'm new to programming thus I do not know most of the advance features for php and Access. I need help in inserting data into the table in Access. I created a .php file to insert the code but it does not work. Here is the code <?php $name = $_POST; $admin = $_POST; $gender = $_POST; $address = $_POST; $hometel = $_POST; $hp = $_POST; $email = $_POST;...
6
11762
by: ashes | last post by:
Hi, I am creating an ecommerce website using Microsoft Visual Studio, VB.Net and MS Access 2003. I am new to VB.Net When someone wants to register on the website, they fill out a form and the contents of the form is inserted into the MS Access database. The Customer table in the database already has 30 records (with CustomerIDs 1 - 30) in it (from when the database was first created). The CustomerID field in the database is an...
2
3119
by: hakkatil | last post by:
Hi to all, I have a page that inserts excel sheet to access database. I am using asp. What I want to do is to check the inserting record if it is in the database. Basicly checking the dublicate record. My code inserts records one by one using addnew-updatebatch. If there is a duplicate in the db, it will display "already exists" and if it is not in the db it will display "record added". Below is my asp code I found on the net and...
0
8828
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9537
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9367
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9319
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9243
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3309
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2213
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.