473,386 Members | 1,705 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,386 software developers and data experts.

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.Empty, 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.OpenRecordset("A",DAO.RecordsetTypeEnum.dbOpenT able,0,
DAO.LockTypeEnum.dbOptimistic);
A.Index="PrimaryKey";

for (int i=1; i<100000;i++)
{
A.Seek ("=", i,
System.Guid.Empty,System.Guid.Empty,System.Guid.Em pty,System.Guid.Empty,System.Guid.Empty,System.Gui d.Empty,System.Guid.Empty,System.Guid.Empty,System .Guid.Empty,System.Guid.Empty,System.Guid.Empty,Sy stem.Guid.Empty);
//...
}

Thank you.
Antonin

Jun 12 '06 #1
1 5990
Use System.Type.Missing 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.Empty, 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.OpenRecordset("A",DAO.RecordsetTypeEnum.dbOpenT able,0,
DAO.LockTypeEnum.dbOptimistic);
A.Index="PrimaryKey";

for (int i=1; i<100000;i++)
{
A.Seek ("=", i,
System.Guid.Empty,System.Guid.Empty,System.Guid.Em pty,System.Guid.Empty,System.Guid.Empty,System.Gui d.Empty,System.Guid.Empty,System.Guid.Empty,System .Guid.Empty,System.Guid.Empty,System.Guid.Empty,Sy stem.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
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...
0
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....
13
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. ...
16
by: ad | last post by:
Does C#2.0 support optional parameters like VB.NET: Function MyFunction(Optional ByVal isCenter As Boolean = False)
10
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,...
12
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...
14
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...
12
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...
7
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...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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
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,...
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...

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.