473,769 Members | 4,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C#, dao, optional parameters and Seek method

I need to use DAO in one of my applications. It was too hard to pass
through by optional parameters for several methods, but now I'm totally
lost at DAO seek method (the main method for key s).
The method has a next declaration:

Sub Seek(Comparison As String, Key1, [Key2], [Key3], [Key4], [Key5],
[Key6], [Key7], [Key8], [Key9], [Key10], [Key11], [Key12], [Key13])
Member of DAO.Recordset

12 optional parameters. I tried anything for the Key2-Key13, without
success - Null, System.Guid.Emp ty, System.TypeCode .DBNull, ... But
without success. The Seek method always returns:

"Additional information: Could not build key."

What can I do with the method?

My code looks like:

DAO.Database db = CreateDatabase( "test.mdb") ;

DAO.Recordset A =
db.OpenRecordse t("A",DAO.Recor dsetTypeEnum.db OpenTable,0,
DAO.LockTypeEnu m.dbOptimistic) ;
A.Index="Primar yKey";

for (int i=1; i<100000;i++)
{
A.Seek ("=", i,
System.Guid.Emp ty,System.Guid. Empty,System.Gu id.Empty,System .Guid.Empty,Sys tem.Guid.Empty, System.Guid.Emp ty,System.Guid. Empty,System.Gu id.Empty,System .Guid.Empty,Sys tem.Guid.Empty, System.Guid.Emp ty,System.Guid. Empty);
//...
}

Thank you.
Antonin

Jun 12 '06 #1
1 6019
Use System.Type.Mis sing for the arguments you want to skip.
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter
Instant C++: VB to C++ converter
"in**@pstruh.cz " wrote:
I need to use DAO in one of my applications. It was too hard to pass
through by optional parameters for several methods, but now I'm totally
lost at DAO seek method (the main method for key s).
The method has a next declaration:

Sub Seek(Comparison As String, Key1, [Key2], [Key3], [Key4], [Key5],
[Key6], [Key7], [Key8], [Key9], [Key10], [Key11], [Key12], [Key13])
Member of DAO.Recordset

12 optional parameters. I tried anything for the Key2-Key13, without
success - Null, System.Guid.Emp ty, System.TypeCode .DBNull, ... But
without success. The Seek method always returns:

"Additional information: Could not build key."

What can I do with the method?

My code looks like:

DAO.Database db = CreateDatabase( "test.mdb") ;

DAO.Recordset A =
db.OpenRecordse t("A",DAO.Recor dsetTypeEnum.db OpenTable,0,
DAO.LockTypeEnu m.dbOptimistic) ;
A.Index="Primar yKey";

for (int i=1; i<100000;i++)
{
A.Seek ("=", i,
System.Guid.Emp ty,System.Guid. Empty,System.Gu id.Empty,System .Guid.Empty,Sys tem.Guid.Empty, System.Guid.Emp ty,System.Guid. Empty,System.Gu id.Empty,System .Guid.Empty,Sys tem.Guid.Empty, System.Guid.Emp ty,System.Guid. Empty);
//...
}

Thank you.
Antonin

Jun 12 '06 #2

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

Similar topics

3
4343
by: Rane Bowen | last post by:
Hi, I am using python with a makepy generated wrapper on a COM application. One of this object's methods has 3 parameters, two of which are optional. If I call the method with just the non-optional parameter, or all three parameters, it works. If I call it with the first two parameters, I get the following error: (-2147352567, 'Exception occurred.', (0, 'Amphora.Session.1', 'A bad parameter was passed to the method', None, 0,...
0
1643
by: lakshmi | last post by:
include the following lines of code: using System.Runtime.InteropServices; prefix the optional argument with This takes care if an optional parameter is not supplied by a VB script client. >-----Original Message----- >I found that optional parameters are not supported in C#. >We are currently rewriting a C++ dll in C#. The C++ dll
13
2516
by: William Ryan | last post by:
I just picked up a copy of John Robbins' debugging book and started to look at disassembled code. Anyway, I hate optional Parameters in VB, but I was checking them out to see what IL is created. I've done this before with Modules, and saw that <gasp> they behave just like sealed classes with only static members. Anyway, it looks like Optional Parameters are nothing but a way to tell the compiler to write some overloads for you. So, in...
16
4062
by: ad | last post by:
Does C#2.0 support optional parameters like VB.NET: Function MyFunction(Optional ByVal isCenter As Boolean = False)
10
6957
by: deko | last post by:
In VB, I could do this: MyFuncrion(this As String, that As Integer, Optional otherThing As Boolean) do stuff here End Function In C#, I can use "out" to return multiple values from a method, and "params" to send in an array, but is it possible to have optional parameters? How do I do this in C#?
12
2298
by: Nick Hounsome | last post by:
Can anyone tell me what the rational is for not supporting optional arguments. It is obviously a trivial thing to implement and, since C++ has them, I would not expect them to be omitted without a good reason.
14
3274
by: cody | last post by:
I got a similar idea a couple of months ago, but now this one will require no change to the clr, is relatively easy to implement and would be a great addition to C# 3.0 :) so here we go.. To make things simpler and better readable I'd make all default parameters named parameters so that you can decide for yourself which one to pass and which not, rather than relying on massively overlaoded methods which hopefully provide the best...
12
2672
by: pamelafluente | last post by:
Hi guys, In the past I have used several time optional parameters in my function. But Now I am more inclined to think that they are more dangerous than useful, and probably better to be avoided. I'd like to hear your various opinions on this matter.
7
13473
by: Sam Shrefler | last post by:
I'm working on creating a WebService / WebMethod to receive a record in real time from another system. The record contains about 20 fields. 10 of which aren't required. I was planning on just making a method with 20 parameters. But, I see there is no way to make an "optional" c# parameter. I was just wondering if anyone had an suggestions on how to implement this? The parameters are all different primitive types (int, string,...
0
9423
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
10049
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...
0
8873
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3965
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
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
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.