SQLite Forum

Queries across databases
Login
> [How are you "using SQLite3.DLL with C#"? ](https://sqlite.org/forum/forumpost/aa286f302c4ee405?t=h)

We've been here! I am loading SQLite3.DLL dynamically in C#. Reasons:

- Available wrappers and drivers are statically linked to one or another historical version of SQLite3. 
- I want to be able to choose the version of SQLite3 that I use; I can keep SQLite3.EXE and SQLite3.DLL in sync.
- There are (were) several versions of SQLite3 on my computer even before I started.

When I started (v 3.34 I think), I could

> .read '| "D:/SQLite32/SCRIPTS/Techniques/N Random Records.BAT" tblSalesRevenue 10'


N Random Records.BAT has:

<code>echo SELECT * FROM [%1] ORDER BY RANDOM() LIMIT %2;</code>

I wanted to be able to use all the math functions without [loading extensions](https://sqlite.org/forum/forumpost/f20c913919437d42?t=h).

The SQLite3.DLL APIs aren't easy to start with; however, with perseverance, the insights gleaned from this forum and other online resources, it all falls into place quite readily.

> ATTACH DATABASE 'c:/sqlite/db/contacts.db' AS contacts;

I am certain that I tried this before posting. <i> (!! did I have SELECT as a prefix !!) </i> Thanks for the help ...

> sqlite3_exec(pdb, "ATTACH DATABASE 'c:/sqlite/db/contacts.db' AS contacts;" ... );

.. is what I need (works).

> there are limits to how many DBs can be attached,

I understand that the default number is 10 but that it would be 125: correct?