I'm having major issues trying to connect an existing SQLite database to my C# application. I've installed SQLite bundle for 32 and 64 bit, I've installed SQLite/SQL Server Compact Tools extension, installed SQLite dlls into GAC, added various different provider tags suggested by dozens of blog posts to my app.config, to my 32 bit machine config, to my 64 bit machine config. Does anybody know just what exactly does one have to do to make Visual Studio let me hook up my SQLite DB to my application?
I'm trying to add a new ADO.NET Entity Data Model to my application by using the option "EF Designer from database". I'm either getting hit with "Unable to find the requested .Net Framework Data Provider" and Visual Studio cannot even find my DB in the dialog (even though I can see it in the Server Explorer).
Or, after I've installed an additional ADO.NET SQLite as VS extension, I can see my SQLite database and test connection is sucess ful, but a soon as hit the Next button I get this:
I've installed EF only through the System.Data.Sqlite NuGet package, I'm maximally confused about this whole provider business.
Please HELP! Thanks!!!
Ok, by following a provided helpful link to a detailed guideline I was finally able to get everything up and running. I've done exactly what's described here: https://github.com/ErikEJ/SqlCeToolbox/wiki/EF6-workflow-with-SQLite-DDEX-provider
However I'm taking the liberty of providing some additional tips for anybody stumbling over the same issue.
I'm still confused about what machine config to manipulate (VS is 32 bit but I'm developing a 64 bit application), so I manipulated both without trying which one matters in that context.
The duplicate closing tag for the DbProviderFactories in the
machine config that's desribed in the mentioned github page as well
as in numerous other blogs might not always be the problem and was
not the case on my machine. But if you encounter it, clean it up
anyway.
If you apply the described changes, double check to make sure that you yourself do not introduce new duplicate tags, otherwise your Visual Studio will start up with an unusual looking start page and crahs, after fixing it all of your pinned editor and tooling windows will be gone and you'll have to re-arrange everything!
Your existing SQLite database (even if visible in the Server Explorer) might still not show up in the Choose Your Data Connection section of the Entity Data Model Wizard after hitting Next.
In that case just select New Connection..., Continue, enter your connection string there into the mask and test the connection before hitting OK. Then your database should be selected and it should work.
In case you don't know the connection string of your SQLite database, but managed to get it into the Server Explorer, you can get it by right clicking and selecting
Properties in the Server Explorer, it will show up in the Properties window.
Related
I published my site on a web server and it works very well (at least to access it) but I would like to use the DB that was automatically created when I was in a development environment.
I initially checked 'Individual account' by creating the project, made some changes (creation of roles, fields in the ASPnetUser table, etc), did some stuff and then publish it and now I would like to recover the DB i had when i was working with Visual Studio on this app (the data inside does not matter to me).
When I published my site with Visual Studio 2017, I was asked to check the providerName and the context.
So I ticked both options leaving the basic information (System.data.SqlClient & connection string to my context (who's not the basic ApplicationDbContext)).
Then, browsing my site, I tried to connect to a login that existed in development on my machine but no way, I also tried to create a new account (thinking that this would regenerate a db) but no way either.
I looked on the internet but I found nothing, except for Microsoft but they use Azure, which does not interest me.
Could you guide me on the processes to follow (even just a link to a tutorial would be very useful)?
I still specify that the server is on Windows Server 16
The best solution for this, in my opinion, is to install a standalone MS SQL server on your machine and create the base of your project not on localdb, but on that server (you need just to change connection string in your Web.config to do it).
I'm trying to create an EDMX file using VS2013 so I can read/write from a DB2 Database. I go through the same process as creating the EDMX from my SQL tables (Right click on project -> Add New Item -> ADO.NET Entity Data Model -> EF Designer from database -> Not using SQL this time so: new connection -> Change data source) but in the Data Source option, DB2 is not available. I have 2 SQL options and that's it.
Data Source
So after doing some investigating around here along with some other places, it looks like EF wasn't actually setup to do this until a plugin for EF6 came out. So using Nuget I have installed EntityFramework.IBM.DB2 version 6.0.3 hoping that would add something to my Data Source area allowing me to choose a DB2 database but still nothing.
I'm gonna try to give as much info about my system here as I know so if I ramble...which I tend to do...sorry in advance.
I'm on Windows 7 using VS2013 Pro edition. I have an ODBC connection setup and it's been working great for years. I can go into the ODBC Manager and test my connection to both Test and Production DB2 and it connects just fine.
The ODBC Data Source Administrator is version 6.1.7601.17632 and I'm using the IBM DB2 ODBC Driver...looks like it's version 10.5.500 (although I'm not 100% sure if I'm looking in the right place to get that version number)
I can also go into Access and connect to the DB2 databases using the ODBC connection and bring back the tables and their data.
I can also write SQL statements directly into my code with the connection string setup (that I assume uses that same ODBC connection) and reads data from SQL and calls Stored Procedures connected to those DB2 tables to write/update/delete.
Lastly, it seems like a previous coworker was able to make this work. I have loaded his code and when I pull up the EDMX, I get the nice graphical display of all the tables. But when I try to click Update from Database, I get an error:
Error Message
Sadly, he is no longer with the company and his computer is not in a condition where I can take a look at it.
So it feels like this is something that can be done and that my computer is almost setup to do this...with the exception of something I'm missing that will allow me to add that DB2 type data source to that first image above so I can select it, put the credentials in and move on.
Any help will be truly appreciated...
In order to use Entity Framework and Visual Studio... you need to install IBM's drivers as well as a Visual Studio Add-in (to make DB2 show up in the dropdown of data providers and create an EDMX properly). The following is the setup we use to communicate with DB2 z/os. I am not sure whether or not these same drivers work with DB2 Linux/Unix/Windows.
http://www-01.ibm.com/support/docview.wss?uid=swg24041453
The above link is for the client version 10.5 fix pack 7. I have used this to setup both Visual Studio 2013 and Visual Studio 2015 in Windows 7/8.1 (have not tested on a Windows 10 development machine).
Here's what you will need to download and install
Data server driver package (Windows)
Database Add-ins for Visual Studio
You will also need a license file (your DBA should be able to provide this for you, or at least download one using their IBM login)
Install the data server drivers first, then the add-ins. Copy your license file to C:\Program Files\IBM\IBM DATA SERVER DRIVER\license
You will still need the EntityFramework.IBM.DB2 nuget package if you wish to use EF6, as the Visual Studio Add-ins by themselves are only compatible with EF5
Thanks for the response.
The Database Add-ins is exactly what I was looking for.
I was able to skip part 1 of your question since I already had that part done except...in order to do part 2, I had to update my drivers to the same version that I was using to install the Add-ins.
I downloaded version 10.5 and updated my drivers then I was able to install the Add-In and was able to continue and create my EDMX.
Thanks so much for the help.
I am trying to develop a C# Windows Forms Application targeting the .net 4 framework. The program will execute a stored procedure against an Oracle Database and I get the following error when I try to open the connection to the database.
ORA-12557 TNS:protocol adapter not loadable
I am developing this in Visual Studio 2012 and have managed to make the Server Explorer connect to the database successfully, however I keep getting this error through my application.
I have two Oracle 11g clients on my machine. One is 32bit and the other is 64bit. I do need both for different applications so it is not possible to remove one. I have also tried changing the order of the Oracle home directories in the PATH variable. Currently I have the 64bit one first which is the one I would like to connect with.
I am connecting my application to the Database using ODP.NET and have referenced the dll from the 64bit application.
As far as I can tell I have done what has been suggested and have not managed to get it working. If anyone could help it would be appreciated.
The ORA-12577 error is related to Windows Environment or Oracle Home PATH because sqlplus command works smoothly when I execute it inside ORACLE_HOME\bin .
Its because of two or more oracle installs (say database and companion) in separate ORACLE_HOMEs on that machine unset the ORACLE_HOME value in your window
For Details please follow the following steps and hope so you will get the solution.
http://www.dba-oracle.com/t_ora_12577.htm
The base problem is that there are DLLs missing in the Oracle instant client installation that exist in the RDBMS server installation that the application requires. This is why switching Oracle homes from client_1 to db_1 works, rather than it being a purely a PATH problem.
sqlplus works in either situation because it uses the minimal set of DLLs which exist in both Oracle installations.
Here are a few things to check. Dont forget to try #3 if needed, it fix the problem for me!
Make sure all Oracle services are started
Make sure environment variables are set (PATH, ORACLE_SID=ORALOCAL, TNS_ADMIN=C:\Dev\Oracle\product\11.2.0\dbhome\NETWORK\ADMIN)
Try shifting the Path environment variable values like so:
“D:\Dev\Oracle\product\11.2.0\dbhome\bin” to be before the
“D:\dev\Oracle\product\11.2.0\client_32\bin” in the order
Fissh
For me I am using IIS .net provider. I was able to fix the problem with sqlplus by putting oracle64 before oracle32 in the path. This did not fix problems with .net. I have apps that use oracle32 and oracle64. To solve this problem registry keys HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ORACLE must point to \oracle32 home and HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE must point to the \oracle(64) home.
I have created a Winforms application using visual studio 2010 in C#.
I created a local SQL Server CE file (.sdf) and added it to my project. Initially, I had a problem as during the course of my application, I was writing data to the database and when I checked in the server explorer, the database always seemed empty but the data values were correct.
I then realized, that the database gets copied to the bin and when I checked that database file, I could see all my data over there.
My connection string is currently
conn = new SqlCeConnection("Data Source =KHDASurvey.sdf");
Now the problem arises when I want to deploy the project to a client's machine. I do not want them to have to install any files or any environments of any sort and I want all the files that are needed to be deployed.
I came across two ways to deploy a project:
the one click method outlined here: here
then another one using setup project here
I like the set up project option so when I run it the user can select where the application
exe file will reside.
I add the files and content to the setup project and then I built it. I create an installer and then I execute it.
When the application is created, I see the .exe and I even see a .sdf file residing in the
same location.
But the application data will only remain while the application is running, then after that I get empty values as it seems nothing is either getting written, read or both. As shown
before, my connection string is set so that it reads from the db file locally.
I have really looked all over for several solutions, I did not find one which completely
explains it. I saw something about altering the connection string in app.config but I am
not really using it in the code, the connection string that is.
Please give me some suggestions or point me in the right direction.
Thank You
Would anyone mind explaining (or pointing me to a tutorial) how to setup an SQL embedded server with Visual Studio Express edition?
I'm not concerned with getting the Designer tab working, but I'm trying to achieve a few basic things:
Access the database via file path
read/write to database file
password to connect to database (not too big of an issue)
The solution I've been pointed to was SQLite to do so, and have seen ADO.Net and Entity Framework to connect the file to the project. So I guess a few important aspects would be that once I set the database up with the project can I
send the projects back and forth to multiple developers?
who are on different computers who have not installed any SQL
related anything?
And is SQLite a viable solution for this?
I've been trying to get a working solution for about 7 hours now.
I suggest you, use SqlCompact 4.0 instead of Sqlite.
You can download SqlCompact 4.0 from Microsoft download center. Also you can easily transfer database between machines. Read about Private Deployment here. And finally an awesome toolbox for using SqlCompact 4.0 stand alone or addons for Visual Studio