I'm trying to use SQLite3 in C#.NET. I've googled around and found some different API's. I also checked SQLite's website for wrappers. I like them, but want to write my own wrapper without using an added dependency. All wrappers I find that don't require an added dependency aren't free.
I'm wondering how one would read from, execute, and write to a sqlite3 database. Is it a socket connection(tcp? udp? etc?)? I've tried searching this answer on google and all I get are library-specific answers. :/ SQLite's website docs aren't much help either.
EDIT: I also found a COM interface while googling, but is that library specific?
Thanks SO! :)
Have you looked at the System.Data.SQLite library? It's a free ADO.NET library to interact with SQLite and requires nothing else in order to run, since it has the engine built into it.
I've been using it for a while now and find it really easy to work with. It even has a plugin for Visual Studio should you decide to use some strongly-typed tables with it or want to use it to add/create tables.
(Answering the "socket connection" question.)
Part of the point of SQLite is that it's an embedded database - there's no server to talk to, you load the library directly into your process and it talks to the file system directly.
If you want to use SQLite in .NET, you should take a look at System.Data.SQLite, which is a ADO.NET provider for SQLite
System.Data.SQLite is comparatively slower than other providers like SqlClient. I have look into its code.
Now I want to call it throw P/Invoke but not like SQLite provider. It call through P/Invoke every time when ever you access column value through DataReader
Related
My background is more in C#/.Net, and have now been offered to move to Intersystems Cache. I haven't found any recent posts on this so unless I missed something here goes:
From what I understand Cache has some mapping for ADO.NET/.NET, but is there something out there so I can use Cache for the DAL and C# for the BL/front end (like ASP.NET MVC)?
Is there a port somewhat similar to Xamarin, that allows one to write everything in C#, using Visual Studio?
I haven't started with Cache yet, but from a brief glimpse it looks somewhat similar to C# being string based and slightly similar approach to interfaces and implementation.
Thanks
Simply put: no.
However, you can use the provided DLL (InterSystems.Data.CacheClient.dll) and the reference (InterSystems.Data.CacheClient) to establish an ado connection to cache. From there you can use SQL to get your data or call a stored procedure from cache. (I'm still researching myself.)
Here's a little tutorial for a c# front-end. (a bit old though, like cache)
http://www.windowsdevcenter.com/pub/a/windows/2006/03/28/oop-c-meets-cache.html?page=1
And some documentation: (this really helped me out)
http://docs.intersystems.com/documentation/cache/20131/pdfs/GBMP.pdf
Good luck and happy coding!
Yea, this is a late response, but here's something that may help, if you're still interested.
I remember back in 2009, Intersystems came out with a .Net Gateway where the Cache developer would create a DLL for you to use to call the different routines and globals. I think that has since been kaput. So I gave up and went with a linked server (static table created by a routine's nightly build) in MS SQL.
Recent searching led me to a link to a framework which I am currently looking into. I haven't tested it yet, but it is a "LinQ API to work with Caché Globals from .NET Entity Framwork"
You may also want to take a look at Caché eXTreme and the samples provided. I'm hoping to implement one of the two (or both) in order to complete a project I'm working on.
after much searching I am going to pose my question here. If there is a duplicate and my search-foo abilities failed me I will gladly defer to it. On to the question.
I have a heavy background in service and web applications, with centralized database servers in an 'always on' way. However, a friend of mine is in need of a simple CRUD application (probably C# due to my limited experience with other GUI libraries/APIs) to replace a costly solution he currently has.
The application itself is very simple and I have planned to use Dropbox as a network layer to keep it even simpler. The issue I'm having trouble solving is that I need a good way to handle a portable database for authentication/authorization. I was considering SQL Lite stored in a read only folder within Dropbox so that it stays current while connected to the internet but doesn't require a network connection to function (They will not always have internet when using the program).
I am looking for suggestions, reading material, or experience with a similar design as a starting place.
Thanks for taking the time to help.
I recommend Sqlite. Works on almost all platforms and pretty easy to use. With .NET I use a micro ORM with it like Dapper.
Here is an example: http://blog.maskalik.com/asp-net/sqlite-simple-database-with-dapper
You can also use SQL Server Compact Edition (SQLCE) to achieve this very quickly. VS provides designers for making SQLCE database files, and ADO.NET plays nicely with it as well. It also supports simple replication as well.
Is it possible to have a connection to LotusNotes and use it as a data source for a C# project?
We use LN for email/calendar. Management wants a web page that would interact with the calendar. I think this can all be done within Notes, but I would much rather do it in .NET.
Some very specific functionality is wanted, some of which I'm not really sure can even be done in Notes.
I know it's possible to interact with LN from C# because we've done it before. We had to wrap their C++ API, but it worked. Unfortunately, I don't have any code to share with you since I no longer work on that project.
I'm not certain what you mean by 'datasource', though.
Do you not have iNotes installed on your mail environment? I would look at using something that's already built instead of starting from scratch.
Have you investigated using the ODBC driver for Notes? It exposes the Notes database as if it were relational.
In my experience, it doesn't perform very well, but if your database is small enough and the transactions few enough, it may suit your purpose.
I am looking at creating a web site and I want to try and learn either a Object Database or a Document Database. I am going to be using a hosting provider so I won't be able to install any software. I am unable to purchase any licensing so I need to be able use either a free or open source Object/Document Database. Are there any free Object/Document Databases that don't require installation of some sort?
This might be a bit late but I am using RavenDB (more here) which works like a charm! It works very well with the RavenDB.Client only and a file based document store for simple scenarios.
Have you looked at http://eloquera.com/?
It is free and is a client/server object database.
It is easy to use and fast.
I found it late last year and think it is a great step forward.
Give it a go ,and I don't work for them I just love what their doing.
Try db4o. Haven't tried it myself but its an embedded OODB. It has a dual GPL/Commercial license.
You can also check STSdb - its an free open-source embedded object database system (NoSQL key/value pair storage engine) designed for mission critical and real-time applications.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am the lone .NET developer in an non-IT organization. I've been asked to develo ae .NET application using Microsoft Access as the back-end (existing DB).
I don't know where to start.
Since I'm developing by myself, what should I keep in mind to avoid during development? What situations does only a lone developer face?
Please include Microsoft Access specific advice in your answer, since that is germane to the question.
Where to start?
Choose a development environment (I would suggest Visual Studio 2008 Express or Professional, depending on the budget and the need for features of the Professional version)
Even for one single developer: choose a Version control system !!!! (Subversion has only little administrative overhead, fine for one developer)
Choose a .NET Framework version (3.5 is fine unless your application has to run on Win2K; for Win2K use .NET 2.0)
Choose a mature programming language (C# or VB.NET, what you or your boss likes best)
Choose a GUI technology (for a single developer, I would suggest using WinForms, unless you are going to write a Web application or a command line utility)
Choose a mature DB access technology (ADO.NET works for a lot of things, unless you have very high performance requirements that are better dealt with old ADO/OleDB or DAO)
EDIT: use Google to find some entry examples according to the choosen technology, or buy yourself a book. For example, here is one for C# using OLE DB to access a MS Access DB. This Access site is a good starting point, too.
EDIT2: make yourself familiar with "Microsoft Access" (the Office Application). Not because you are going to use it like a typical user, but you will probably need it for administrative purposes. And the VBA & SQL documentation included will be sometimes helpful, even if you code with C# or VB.NET
EDIT3: for reporting purposes, choose a reporting technology. There are plenty of possibilites here, depending on your needs, your skills and/or budget, for example
Plain ASCII or CSV reports (coded by hand)
HTML or XML reports
using Excel as reporting engine
using a PDF library like Report.NET
using a third party tool like Crystal Reports
You will find a lot of helpful links when you give "report generation .net" to Google, for example this one.
And finally: come back to SO and ask more concrete questions when you come to the point where you have them.
There might be other constraints, depending on what code is already existing in your organization. And I would avoid technologies like F#, WPF or Linq to Entities.
Your question is too vague to give more than just general advice. If you have already developed other .Net applications, then the approach to developing this new application should not really be any different.
Database considerations:
The only things to bear in mind when using MS Access as a back-end database are:
Scalability - MS Access does not
scale very well and is only suitable
for a small number of users
*EDIT: Numbers vary depending on the type of activity the users are performing - for a reporting solution, Microsoft themselves suggest that up to ~100 concurrent users is the maximum - this white paper provides more information *
Security - MS Access does not offer the same sophisticated levels
of security that you will find in
other database products (SQL Server,
Oracle, MySQL)
SQL Syntax - there are some subtle differences in the way you
write certain types of query for MS
Access
Other Limitations - MS Access does not support stored procedures, so all your data access code will have to use inline SQL Commands (command.Type = CommandType.Text)
The maximum database size supported by Microsoft Access is 2GB - keep an eye on the growth of the database
Design considerations:
Does the existing MS Access database already have some user forms and code modules in it? If so, you could use these as the basis for your application - MS Access uses Visual Basic for Applications (VBA) as it's programming language and there are no tools/utilities that I know of that will port VBA to VB.Net
Do similar applications exist elsewhere that could help inform your design?
Keep data access code out of your forms as much as possible - try to keep data access code in a separate class/DLL so that it is easier to maintain
EDIT: as others have suggested, try to avoid having instances of ADO.Net connection and command objects scattered throughout the user interface - put all database connection code in one class/DLL so that it easier to fix/maintain/replace. I'd also suggest putting all your SQL query statements in a separate class or module for the same reason. *
Follow any in-house guidelines that you, or others before you, have put in place.
Keep maintainability in mind - someone after you may have to make changes. Use comments in code and give your objects (forms/variables/function names) sensible names
Take regular backups of your code - put a copy on a network drive or USB drive every day
One point of advice, encapsulate all Access-specific code within a single class. The class should at least be able to:
locate the Access .mdb file
create and open all OleDbConnection objects
It's critical that all Connections are guaranteed to close, so wrapping their use in a using block is a very good idea
(Possibly) build and execute all OleDbCommands (removing the db-specific logic from the consuming components--they should be able to make data-requests and retrieve results while transparently creating the Connection & Command, etc.
For accessing the Access database, you could maybe have a look at NHibernate? As far as I know it supports Microsoft Access and using a library like that could perhaps make things easier if you are going to move the data to some other kind of database later on.
If you are already familiar with a .NET language and MS Access then my advice would be to start off by developing a very simple MS Access database and write a small .NET console application that connects to that database and performs some basic functions e.g. querying/inserting/deleting/updating. Then its just a case of builiding on top of this piece by peice, introducing GUIs/separate libs (dlls) etc on the way.
Unfortunately for you .NET Linq to SQL (ORM) does not support MS Access databases so you will have to develop your Business Objects from scratch (not always a bad thing!).
Here is a good starting point MS Application with C#.
There is a lot of good advice here, all I would add is be sure to build all your data access and modifying classes behind a well defined interface(s). I am sure there will come a time when this application out grows MS Access and having well defined interfaces will make upgrading to another database easier.