How do I connect my application to eXist-DB - c#

i've created a c# application that is effectively a workflow system that moves XML documents around folder structures depending on their status, among other things.
What i'd now like to do is use a database to store the XML files instead of local folders, but I still need to be able to query them with Linq / XQuery. I've chosen eXist-DB as my database it is gets some fairly good praise.
My question is, how do I connect to my newly created DB from my C# application. If i choose the 'Connect to a DB' option in Visual Studio i'm presnted with a bunch of SQL server options, but nothing that appears to be of any use to connect to my nice new eXist DB.

Related

Unrecognized database format when opening Access file inside Visual Studio - Why?

I have recently taken a project for a client which involves working with their Microsoft Access database programmatically with C# in Visual Studio 2015/2017.
The database opens in my 64-bit version of Microsoft Access 2010 just fine, and I can use/alter all tables/queries perfectly fine. However, when trying to open this .accdb database in Visual Studio, I am getting the dreaded "Unrecognized database format". Now, I do have the Microsoft Office Access database engine for 2007 and 2010 installed, and I am able to open/work with other databases created in Access.
I believe the database was created in Access 2007, as when I open it up, the title of the window contains "(Access 2007 - 2010)", so I'm not sure if that would cause the error or not?
One interesting thing I found was, because I do not need every table in the database, I copied one by one the tables I need into a new database file and checked if I could open this new Access database in Visual Studio. Out of 6 tables that I needed, the last one I needed caused the file to become "unrecognizable" inside Visual Studio.
Why? I have no idea. The table is just like any other, contains lots of columns which either have text, numbers or dates.
My question is, has anybody had a similar experience with this? Could it be the fact that it was made from Access 2007? Why would copying and pasting to a new database then cause that database to be corrupt?
Thanks a lot.
There's a difference in the formats. The older format (..2007) is MDB and the later ones (2010...) are ACCDB. If you used any features only available in ACCDB, like attachments, you cannot convert back to MDB and neither will ANY current Microsoft tool other than Access open it. Strange but true.
Painful is to exclude those tables or forms that use the new features and then do the conversion.....sigh.....

Use SMO to locate correct backup path

I am developing a software using a MSSQL database for holding the data. In the program I implemented a function for creating a backup with SMO.
Now I am trying to implement a restore function. It works without any problems when the user has to insert the path manually. But I want to implement a select file dialog like this one the SQL Server Management Studio (SSMS) is opening when selecting a custom medium (see on the screenshot).
I already found the Microsoft.SqlServer.Management.Smo.Server class with the method EnumDirectories, but it returns only directory names and no files. When I confirm the selection I need the path in format C:\Directory\FileName.bak.
Is it possible to meet my needs with using SMO?
Many months ago I found a solution. I just developed a custom SelectFileDialog which is able to connecto to SQL server and work with the following SQL functions:
For searching available drives:
exec xp_fixeddrives
For reading folders and files:
exec xp_dirtree 'PATH', 1, 1
The PATH variable is dynamicly replaced depends on which folder is expanded by the user. It works without problems.

How to configure BDE to connect to an existing Paradox db with .net application?

Hoping in can find someone who is familiar with this scenario. I've not touched Paradox in over 12 years, and most posts I find on the subject are 5+ years old.
I have created a C# application to read a Paradox .db file using OLEDB and the Borland Database Engine (BDE) to retrieve a transaction code. I have no control over the Paradox system, my only access to it is through a UNC path to the .db files. The original developers of the system are no long in business, so there is no support. Hence the reason I'm having to "hack" a solution to my customers problem.
For development I copied the relevant .db files locally and had no problem accessing them. However when I try to access the live files, the error I get is that they are under the control of a different .LCK file. Deleting the .LCK file solves the access issue, but obviously that is not the solution.
The existing system has the "server" a Win7 machine, and 3 clients running what I assume is the Borland / Paradox application.
Is there a way to configure BDE (or some other workaround) to allow access to the live files using the existing .LCK files? I've tried with different values in the BDE "NET DIR" setting.
My only other option that I can see is to load the entire .db file into memory, (I have code that does that without BDE) then find my transaction value, which is not ideal as that takes around 15 seconds, and as this is a Point of Sale application, it needs to be much faster. Select statements via OLEDB work perfectly in this regard.

deployable database on CD

I have a Microsoft SQL database that is currently connected to a winforms C# application, it works fine on the single computer, but i would like it to be usable on a CD for any user.
I tried putting it in as a localDb but for some reason the database is duplicated and put into the bin folder, it causes multiple issues in recording data, for instances i save user ID 5 it saves in bin but never makes changes to the real database. Then next i go to create it, the user ID changes to 7 with user 6 not visible in either two databases (yes it is auto incremented by 1)
Any suggestions or best methods on making a database useable and readable via CD if the winform application is also on the CD
I have not tried this my self, but according to the documentation SQLite supports read-only databases.
If the file is read-only (due to permission bits or because it is located on read-only media like a CD-ROM) then SQLite opens the database for reading only. The entire SQL database is stored in a single file on the disk. But additional temporary files may be created during the execution of an SQL command in order to store the database rollback journal or temporary and intermediate results of a query.
see https://www.sqlite.org/c_interface.html
.NET SQLite providers are available here:
https://github.com/praeclarum/sqlite-net
http://system.data.sqlite.org/index.html/doc/trunk/www/index.wiki

Failed to update database "*.mdf" because read only EntityFramework

I have a C# .NET Framework 4.0 desktop application with Entity Framework as DAL.
When a try to save a data into DBContext on anybodies machine but mine, I recieved an exception
Failed to update database "*.mdf" read only
I keep my DB near .exe file, in folder "DAL/AppData".
How can I allow write access on other machines?
Can I do it programmatically?
I've read that I can place DB into AppRoaming Folder, but this is not my variant.
Thanks in advance.
I keep my DB near .exe file, in folder "DAL/AppData".
Yes. Can it be you mean that this is in the programs file folder, you know.
THe one that windows specs of the last 10 years say is "read only" for normal users?
OUCH.
THer are folders for storing data. There is a SpecialFolders enumeration to get the valid path of every such folder.
How can I allow write access on other machines? Can I do it programmatically?
On a SQL Server, this is done by allowing the other computer to access the server, not the data files. I.e. you connect to the SQL Server on the other machine, which is having the database loaded.
I've read that I can place DB into AppRoaming Folder, but this is not my variant.
First, that would be stupid unless you do actually plan for roaming - SQL shold go into a local folder, never roaming.
Second, "not my variant" is like "Hey, I drive the car against the rules, what can I do not to get speeding tickets". And "following the law is not my variant". Your variant is something WIndows does not care for. Learn how to install your software according to the windows guideline which is VERY clear where changing data should NOT be.

Categories

Resources