473,405 Members | 2,300 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,405 software developers and data experts.

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.ExecuteNonQuery();. 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 6089
"Zak Milas" <Za******@discussions.microsoft.com> schrieb:
inserting or pasting less data. Is the error I get when it get
dbCmd.ExecuteNonQuery();. 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.public.dotnet.framework.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******@discussions.microsoft.com> wrote in message
news:AB**********************************@microsof t.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.ExecuteNonQuery();. 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.Parameters.Add("@open_call",
OleDbType.VarChar, 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.Parameters.Add("@open_call",
OleDbType.VarChar, 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.Boolean?


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.Parameters.Add("@open_call",
OleDbType.VarChar, 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.Boolean?


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****************@TK2MSFTNGP09.phx.gbl...
>I am using Parameterized Query; dbCmd.Parameters.Add("@open_call",
> OleDbType.VarChar, 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.Boolean?


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****************@TK2MSFTNGP09.phx.gbl...
>I am using Parameterized Query; dbCmd.Parameters.Add("@open_call",
> OleDbType.VarChar, 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.Boolean?


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.Boolean).value=bOpenCall
cmd.parameters.add("@call_desc", OleDbType.varchar,50).value=sDesc

This will fail.

Just my .02.

Greg
"Zak Milas" <Za******@discussions.microsoft.com> wrote in message
news:4C**********************************@microsof t.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****************@TK2MSFTNGP09.phx.gbl...
>> >I am using Parameterized Query; dbCmd.Parameters.Add("@open_call",
>> > OleDbType.VarChar, 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.Boolean?
>
> 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.Boolean).value=bOpenCall
cmd.parameters.add("@call_desc", OleDbType.varchar,50).value=sDesc

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
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...
7
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...
3
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...
15
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,...
3
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...
20
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...
0
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...
2
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...
6
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...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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,...
0
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...

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.