473,573 Members | 2,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Old ADO problem

Hello,

i've created an old-ADO-recordset in C# via the following
code:

ADODB.Recordset Class arTest;

arTest = new ADODB.Recordset Class();

arTest.Fields.A ppend("Field1",
ADODB.DataTypeE num.adInteger, -
1,ADODB.FieldAt tributeEnum.adF ldUnspecified,n ull);

arTest.Fields.A ppend("Field2",
ADODB.DataTypeE num.adInteger, -
1,ADODB.FieldAt tributeEnum.adF ldUnspecified,n ull);

arTest.Open(nul l, null,
ADODB.CursorTyp eEnum.adOpenFor wardOnly,
ADODB.LockTypeE num.adLockReadO nly,-1);

So far, so good, seems to work. Now i want to fill it with
data:
arTest.AddNew(" Field1", 1);

And what i got is this:
Unhandled Exception:
System.Runtime. InteropServices .COMException (0x800A0BB9):
Arguments are of the wrong type, are out of acceptable
range, or are in conflict with one another.

Any ideas, how i can handle this?

Thanks in advance,
Daniel


Nov 15 '05 #1
2 5871

Hi Daniel,

I should have caught this in my previous post. You need to change your call
to the Open method a little further. Try:

using System.Reflecti on;
using ADODB;
...........
arTest.Open(Mis sing.Value, Missing.Value, CursorTypeEnum. adOpenStatic,
LockTypeEnum.ad LockOptimistic,-1);
Full sample code for a console app follows:

using System;
using System.Reflecti on;
using ADODB;

namespace ConsoleApplicat ion3
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
ADODB.Recordset Class arTest;

try
{
arTest = new ADODB.Recordset Class();

arTest.Fields.A ppend("Field1",
ADODB.DataTypeE num.adInteger, -
1,ADODB.FieldAt tributeEnum.adF ldUnspecified,n ull);

arTest.Fields.A ppend("Field2",
ADODB.DataTypeE num.adInteger, -
1,ADODB.FieldAt tributeEnum.adF ldUnspecified,n ull);

arTest.Open(Mis sing.Value, Missing.Value,
ADODB.CursorTyp eEnum.adOpenSta tic,
ADODB.LockTypeE num.adLockOptim istic,-1);

arTest.AddNew(" Field1", 10);

System.Console. WriteLine("Fiel d added. Value of first field
is {0}", arTest.Fields[0].Value.ToString ());
}
catch (Exception ex)
{
System.Console. WriteLine(ex.Me ssage);
}
finally
{
System.Console. ReadLine();
}
}
}
}
--
Rob Windsor
G6 Consulting
Toronto, Canada

"Daniel" <da****@luetk e-wiesmann.de> wrote in message
news:0b******** *************** *****@phx.gbl.. .
Somebody send me a hint, that the recordset is opened as
read-only. I've changed it to:

arTest.Open(nul l, null,
ADODB.CursorTyp eEnum.adOpenSta tic,
ADODB.LockTypeE num.adLockOptim istic,-1);

But the error still occures.
-----Original Message-----
Hello,

i've created an old-ADO-recordset in C# via the following
code:

ADODB.Recordse tClass arTest;

arTest = new ADODB.Recordset Class();

arTest.Fields. Append("Field1" ,
ADODB.DataType Enum.adInteger, -
1,ADODB.FieldA ttributeEnum.ad FldUnspecified, null);

arTest.Fields. Append("Field2" ,
ADODB.DataType Enum.adInteger, -
1,ADODB.FieldA ttributeEnum.ad FldUnspecified, null);

arTest.Open(nu ll, null,
ADODB.CursorTy peEnum.adOpenFo rwardOnly,
ADODB.LockType Enum.adLockRead Only,-1);

So far, so good, seems to work. Now i want to fill it

with
data:
arTest.AddNew( "Field1", 1);

And what i got is this:
Unhandled Exception:
System.Runtime .InteropService s.COMException (0x800A0BB9):
Arguments are of the wrong type, are out of acceptable
range, or are in conflict with one another.

Any ideas, how i can handle this?

Thanks in advance,
Daniel


.

Nov 15 '05 #2
Well, this works. Many thanks!

Greetings,
Daniel
-----Original Message-----

Hi Daniel,

I should have caught this in my previous post. You need to change your callto the Open method a little further. Try:

using System.Reflecti on;
using ADODB;
...........
arTest.Open(Mi ssing.Value, Missing.Value, CursorTypeEnum. adOpenStatic,LockTypeEnum.a dLockOptimistic ,-1);
Full sample code for a console app follows:

using System;
using System.Reflecti on;
using ADODB;

namespace ConsoleApplicat ion3
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
ADODB.Recordset Class arTest;

try
{
arTest = new ADODB.Recordset Class();

arTest.Fields.A ppend("Field1",
ADODB.DataTypeE num.adInteger, -
1,ADODB.FieldAt tributeEnum.adF ldUnspecified,n ull);
arTest.Fields.A ppend("Field2",
ADODB.DataTypeE num.adInteger, -
1,ADODB.FieldAt tributeEnum.adF ldUnspecified,n ull);
arTest.Open(Mis sing.Value, Missing.Value,
ADODB.CursorTyp eEnum.adOpenSta tic,
ADODB.LockTypeE num.adLockOptim istic,- 1);
arTest.AddNew(" Field1", 10);

System.Console. WriteLine("Fiel d added. Value of first fieldis {0}", arTest.Fields[0].Value.ToString ());
}
catch (Exception ex)
{
System.Console. WriteLine(ex.Me ssage);
}
finally
{
System.Console. ReadLine();
}
}
}
}
--
Rob Windsor
G6 Consulting
Toronto, Canada

"Daniel" <da****@luetk e-wiesmann.de> wrote in message
news:0b******* *************** ******@phx.gbl. ..
Somebody send me a hint, that the recordset is opened as
read-only. I've changed it to:

arTest.Open(nul l, null,
ADODB.CursorTyp eEnum.adOpenSta tic,
ADODB.LockTypeE num.adLockOptim istic,-1);

But the error still occures.
>-----Original Message-----
>Hello,
>
>i've created an old-ADO-recordset in C# via the following >code:
>
>ADODB.Recordse tClass arTest;
>
>arTest = new ADODB.Recordset Class();
>
>arTest.Fields. Append("Field1" ,
>ADODB.DataType Enum.adInteger, -
>1,ADODB.FieldA ttributeEnum.ad FldUnspecified, null);
>
>arTest.Fields. Append("Field2" ,
>ADODB.DataType Enum.adInteger, -
>1,ADODB.FieldA ttributeEnum.ad FldUnspecified, null);
>
>arTest.Open(nu ll, null,
>ADODB.CursorTy peEnum.adOpenFo rwardOnly,
>ADODB.LockType Enum.adLockRead Only,-1);
>
>So far, so good, seems to work. Now i want to fill it

with
>data:
>arTest.AddNew( "Field1", 1);
>
>And what i got is this:
>Unhandled Exception:
>System.Runtime .InteropService s.COMException (0x800A0BB9): >Arguments are of the wrong type, are out of acceptable
>range, or are in conflict with one another.
>
>Any ideas, how i can handle this?
>
>Thanks in advance,
>Daniel
>
>
>
>
>.
>

.

Nov 15 '05 #3

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

Similar topics

11
3739
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class (ClassB* b; b->func(); ) the base-class function is called instead of the new function in the derived class. All other similar functions (virtual in...
9
2231
by: Sudesh Sawant | last post by:
Hello, We have an application which communicates using remoting. There is a server which is a Windows Service. The server exposes an object which is a singleton. The client is a Web Application which makes calls to the service. We are using tcp channel which is using binaryformatter by default. The problem is that after a certain number of...
117
7114
by: Peter Olcott | last post by:
www.halting-problem.com
0
3639
by: James Griffiths | last post by:
Here is a report I've written about a printing problem that is being experienced by a particular company for whom I had developed a A97 system. After upgrading to Win XP and AXP, some printing problems have arisen. My investigations show that it is not related to the particular system I developed. but is affecting Access in general. So, has...
18
6147
by: Ian Stanley | last post by:
Hi, Continuing my strcat segmentation fault posting- I have a problem which occurs when appending two sting literals using strcat. I have tried to fix it by writing my own function that does the strcat (mystract). Program below. However this appears not to have fixed the problem and I don't know why it shouldn't ? Any further help as to...
28
5186
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass(); .... and then call the virtual method, why is it that the base class's method is called instead of the overridden method? How do I fix this if I...
6
3790
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length is more that 1249 bytes, then the progress bar of the browser will move too slow and then displaying that the page not found!!!! If the message is...
16
4883
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by Microsoft must be installed on their servers. Now german Umlaute (ä, ü, ö) and quotes are returned incorrectly in SOAP fault responses. This can be...
2
4537
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was set to...it is set to false. Can someone show me what I am doing wrong and tell me the correct way? Thank you. In the page load event, I am...
9
3635
by: AceKnocks | last post by:
I am working on a framework design problem in which I have to design a C++ based framework capable of solving three puzzles for now but actually it should work with a general puzzle of any kind and I need your able help in this activity. Objective - In this activity you will design a framework capable of solving any puzzle of a specific type...
0
7746
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
7668
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...
0
7983
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. ...
1
7735
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
8035
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...
1
5556
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
3698
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3694
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1269
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.