PC Review


Reply
Thread Tools Rate Thread

C#, dao, optional parameters and Seek method

 
 
info@pstruh.cz
Guest
Posts: n/a
 
      12th Jun 2006
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.dbOpenTable,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.Empty,System.Guid.Empty,System.Guid.Empty,System.Guid.Empty,System.Guid.Empty,System.Guid.Empty,System.Guid.Empty,System.Guid.Empty,System.Guid.Empty,System.Guid.Empty);
//...
}

Thank you.
Antonin

 
Reply With Quote
 
 
 
 
=?Utf-8?B?RGF2aWQgQW50b24=?=
Guest
Posts: n/a
 
      12th Jun 2006
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


"(E-Mail Removed)" 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.dbOpenTable,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.Empty,System.Guid.Empty,System.Guid.Empty,System.Guid.Empty,System.Guid.Empty,System.Guid.Empty,System.Guid.Empty,System.Guid.Empty,System.Guid.Empty,System.Guid.Empty);
> //...
> }
>
> Thank you.
> Antonin
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pass optional parameters to a method in a Dictionary (C#2.0) ? Artie Microsoft C# .NET 10 11th Feb 2010 07:39 PM
CodeDom Optional parameters on a method Eric Microsoft Dot NET 0 24th Aug 2006 05:07 AM
basic: Is it possible to define optional parameters in a method declaration? how? Juan Microsoft C# .NET 12 8th Feb 2005 02:55 PM
optional parameters in a method =?Utf-8?B?QW5kcmV3?= Microsoft C# .NET 2 22nd Oct 2004 05:57 PM
Call COM object method with optional parameters. Yong Jiang Microsoft C# .NET 4 25th Nov 2003 12:25 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:29 AM.