[C#] Creating and Editing a Database(Access or SQL probably)

Started by Apidcloud, December 02, 2012, 01:06:44 pm

Previous topic - Next topic

Apidcloud

Hey there,

few weeks ago, when I had Microsoft office 2010 installed, I made a little program that created and edited an excel file. I just had to use Microsoft Office 2010 Interop Assemblies library.
The thing is, as I uninstalled office 2010 to install 2013, the program isn't working anymore  >:(
I saw a thread with an  ExcelLibrary but I'm not sure whether Excel is the way to go. I just need to create a database so I can later open the file or create a specific program to open it and show the contents of a specific week and what not. I'm thinking about using Access or SQL, which I can modify directly using visual studio

What are the pros and cons of those databases?

Thanks
Instead of wanting to be somebody else, rather become somebody else



"I will treasure the knowledge like a squirrel treasures acorns."


Gibbo Glast 2D Engine - The sky is no longer a limit

Ryex

well, it all depends on what exactly you need to do with this "database"

if you use SQL I would recommend SQLLite as it technically just uses a file and doesn't need a server to be running to do the look ups ect.
but really I don't see what you need a special database lib at all. is there a reason you cant just com up with a way to store what you need in files yourself? use serialization to write some sort of table object to a file?
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Apidcloud

Well, I needed a library to create/edit excel files - microsoft.office.interop did the job

I need a "database" to store every registry I create with a program made in C#. Basically, my program will ask the user for some data, and use that to create some more fields. Access allows me to create formulas in specific fields, so I just need to fill the initial ones and Access will do the rest. In Excel it would be more or less the same but it'd require some more work.

I first came up with excel because I simulated registries in there. But I'm thinking about using an Access file because I can connect directly to it using OleDb.

I never used SQL so I can't tell the differences between this and Access, but I don't need a server to be running to do the look ups.

Which one would be better? That if there are technically any major differences between them

Thanks
Instead of wanting to be somebody else, rather become somebody else



"I will treasure the knowledge like a squirrel treasures acorns."


Gibbo Glast 2D Engine - The sky is no longer a limit

phcs666

With Access you can make your app carry the database within it (like a portable DB), SQL is for bigger databases and need to be running on a server, then your app will not be able to carry it (the DB will be "stuck" in the mahcine you created it)

You can backup the SQL database and then restore it in the machine that your app is going to run but why would you do this if with Access you can just run your app without caring about the DB?

You could also make your app run a SQL script in the startup to create the database BUT, for both methods, a SQL instance must be installed in the machine, while Access only needs MS Office wich almost every PC has it.

SO i recommend you using Access for small apps ^^

God sorry for any bad english  :^_^':

Apidcloud

Your English is just fine  :haha:

Well I just want to use a database that isn't carried in my app, that is, I open it using code, instead of adding it to visual studio databases.

Still, I'm having an huge problem  >:(
When I try to open it, this error is raised: Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine error

I bet it's because I got office 2013 installed  :facepalm: After searching a little bit, I found this thread which suggests to download access database engine in order to open it. I installed and it still doesn't work. This time the error is: Unrecognized data format  :facepalm:
For the record, I'm just trying to add the database to vs, so I can get the connection string  :haha: I'll do it entirely with code

Any suggestions to solve this?
Thanks
Instead of wanting to be somebody else, rather become somebody else



"I will treasure the knowledge like a squirrel treasures acorns."


Gibbo Glast 2D Engine - The sky is no longer a limit


Apidcloud

vs 2012

Edit:
I verified this path C:\Program Files\Common Files\Microsoft Shared\OFFICE14 and I got ACEOLEDB.DLL there, so I don't get what's wrong

2nd Edit:
I uninstalled previous access manager and installed x64 one. First error is raising again: Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine error   :facepalm:
Instead of wanting to be somebody else, rather become somebody else



"I will treasure the knowledge like a squirrel treasures acorns."


Gibbo Glast 2D Engine - The sky is no longer a limit

G_G

Check this out.
http://code.google.com/p/csharp-sqlite/

This lets you read/write databases to files. I've used it a couple of times.
A) You don't deal with Visual Studio databases
B) The end user doesn't need to have any sort of SQL installed

Apidcloud

 :facepalm: I created a 2010 access file on my brother's computer, tried to open it using visual studio and it worked. I wonder my file doesn't work, it's in 2007-2013 format  :huh:

I will try to figure out why later.



Quote from: gameus on December 02, 2012, 06:57:02 pm
Check this out.
http://code.google.com/p/csharp-sqlite/

This lets you read/write databases to files. I've used it a couple of times.
A) You don't deal with Visual Studio databases
B) The end user doesn't need to have any sort of SQL installed


I'll try it tomorrow and check the differences  :haha:
I'm still not sure about application's and database's requirements
Office 2010/2013 is needed for sure, don't know about the rest though

thanks
Instead of wanting to be somebody else, rather become somebody else



"I will treasure the knowledge like a squirrel treasures acorns."


Gibbo Glast 2D Engine - The sky is no longer a limit