in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

SQLiteParameterCollection

Last post 07-26-2007 3:49 PM by JamesD. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 09-02-2006 1:54 PM

    • CTP
    • Top 200 Contributor
    • Joined on 09-02-2006
    • Posts 7

    SQLiteParameterCollection

    Hi,

    I tried to create an instance of SQLiteParameterCollection and got this error:

    The type 'System.Data.SQLite.SQLiteParameterCollection' has no constructors defined.

    This is with 1.0.33 on VS 2005. Looking at the interface through metadata shows that there isn't a public constructor.

    Regards,
    CT

  • 09-02-2006 2:34 PM In reply to

    Re: SQLiteParameterCollection

    Yep!  You'll find you can't create a SqlParameterCollection or an OleDbParameterCollection or an OdbcParameterCollection either -- they're not designed to be instantiated by themselves.

    The parameter collection is exposed through a command object and cannot exist alone.  If you want to get an instance of a SQLiteParameterCollection you need to first create a command.

    Robert

     

  • 09-06-2006 8:42 PM In reply to

    • CTP
    • Top 200 Contributor
    • Joined on 09-02-2006
    • Posts 7

    Re: SQLiteParameterCollection

    Hi Robert,

    Thanks a lot for the info!

  • 07-26-2007 2:17 PM In reply to

    • JamesD
    • Top 200 Contributor
    • Joined on 07-26-2007
    • Posts 8

    Re: SQLiteParameterCollection

    rsimpson:

    Yep!  You'll find you can't create a SqlParameterCollection or an OleDbParameterCollection or an OdbcParameterCollection either -- they're not designed to be instantiated by themselves.

    The parameter collection is exposed through a command object and cannot exist alone.  If you want to get an instance of a SQLiteParameterCollection you need to first create a command.



    Hmm, this throws me into a bind, I've been using ParameterCollections to pass parameters around between various functions (which have a number of commands in them, but use the same parameters).

    Any thoughts on how you see doing that under SQLite? (Under MySql I can just instanciate a MySqlParameterCollection and add my parameters to it).
  • 07-26-2007 2:34 PM In reply to

    Re: SQLiteParameterCollection

    Ah -- that feature would be unique to MySql then.

    I'd recommend a more generic approach, which would be to use an array and call the Command.Parameters.AddRange() command to add the entire array to the parameters for the command.

    Robert

     

  • 07-26-2007 3:49 PM In reply to

    • JamesD
    • Top 200 Contributor
    • Joined on 07-26-2007
    • Posts 8

    Re: SQLiteParameterCollection

    Okay, well eventually I'll try that, for right now I'm being bad and using horrid coding to create a SQLiteParameterCollection (by creating a dummy command, adding my parameters to it, and then using SQLiteCommand.Parameters to retrieve the Parameter Collection).

    It's ugly, but for now it works.,...
Page 1 of 1 (6 items)
Powered by Community Server (Commercial Edition), by Telligent Systems