I just get project from my friend for learning some stuff, the project is simple windows forms application made in Visual Studio (VB as code behind), he moved the project to my machine and we run the project without any problems, it connected to the database and we get results from DB loaded into grid.
But when I tried to edit some stuff on the project like adding new DATASET I received this error, and even when I want to add new QUERY in TABLE ADAPTER or if I want to see the code of existing dataset I am receiving again the same error.
This means I am missing some DLL's in my visual studio?
When You create the application and it should connect to some database system, it needs to have a negotiator between the App and the Database. For this purpose You must use some DataAccess provider.
There exist multiple versions for all the Databases (MySQL, MS-SQL, Oracle DB, Postgree...). As the DB syntax is evolving (the language), also the versions of DataAccess providers are increasing.
Basically each DB requires some minimal version of provider to work with. As Your computer does not have any valid installed, it throws errors. The best You can do check what version is used by Your colleague and download the same or higher from the Oracle web.
Related
I'm using:
Visual Studio 2013
.NET Framework 4.5.1
Microsoft Access 2010
I'm currently working on a C# school project that doesn't require us to use a database at all, however we can grab some extra credit if we implement a database.
I've worked with SQLite so far and had not much trouble setting up the connection, however we are limited to Access for the project.
I would like to use the database in an ADO.NET Entity Data Model, but upon trying to add the .edmx Item via the solution explorer it doesn't let me choose "Access Database".
Is there any way to get an Access Database and the EDM to work together?
There is a JetEntityFrameworkProvider available on github. Compile the code and run the Install.cmd from JetDdexProvider folder:
To get DDEX Provider installed.
I'm using Visual Studio Enterprise 2015, along with the Github plugin.
For a assignment I have to use C# with a database, which isn't a problem within VS. But, I want to check the local database into the repository, so I can work on the project on multiple computers.
I'm the only one who will use this repository (it's private). There won't be changes apart from my own.
I know it's not really meant to do this, but I really would like to remain working with local databases for simplicity purposes.
I've found this answer on the topic, but I'm not sure what he's trying to say.
I do really thank you for asking such a beautiful question that opened my mind . And I found this blog and it really explains how to do this job . And I realized that I will be needing this :) . Please check out the synchronizing-a-mysql-database-with-git-and-git-hooks Hope this helps .
When you use Visual Studio together with SQL Server Developer tools you can have your database schema and initial data scripted out as a Visual Studio project. You'd then use the Visual Studio project to define what the database looks like and you can then use the project to create a SQL Server LocalDB or SQL Server Express database on demand when you restore your project. You can sync the schema between your local database and the Visual Studio project. And commit the difference to git.
Alternatively you could use something like Entity Framework to define your database schema or use Entity Framework Code First annotations to map your object model to a database schema. Combined with Entity Framework Migrations and Entity Framework Data Initializers you can instruct you application to rebuild the database at startup time should it be missing.
Using Git pre-commit hooks on Windows is not the easiest thing to setup and Visual Studio 2012-2015 won't execute your hooks, you'd have to do all your git operations through the commandline for these hooks to start working. Visual Studio 2017 uses the git.exe commandline tool and should be able to run your hooks, though support for hooks is still limited if you're using a normal command shell instead of a bash shell (linux shell). Most hooks are implemented as Linux shell scripts or other scripting languages that are not always fully supported on Windows.
Depending on the file size, you could always just commit the database file itself, the binary files. Though git generally doesn't like binaries, nothing prevents you from committing the latest state and transferring it to another machine this way.
I usually but the instructions to build the database into the repository, either a .sql file or a script to execute the commands needed to restore the database.
A database like sqlite is stored in only one file, that you could easily put in your git repository.
If your looking for more concrete ideas, you might want to share what database your working with.
I want to create a setup file from a C# project in Visual Studio 2015 that attaches a SQL server database, and I want to run that setup file on another system and run without Visual Studio and SQL server
You are have two solutions
You should develop your application with SQL express on .NET framework or after develop with SQL Server change connection string from SQL Server to SQL express and rebuild it, be sure you create initialize DbContext class to set some data for run your application at first time with base and default data. [Such as application users and rolls and groups].
You should develop your application with dependency injection pattern [Microsoft Unity, IoC] then modify or replace one interface to change your developed application database.
Then Right click on project in solution explorer and publish it and give to customer.
The customer server has to run some kind of SQL Server if you want the SQL data to be accessed somehow. One thing you can do is to deploy your C# project with Visual Studio, export all needed tables (including their data if you want that) from whatever server you are using (for example MySQL) into a .sql file and pack everything, including instructions on how to install the sql server and your application, into a zip file and ship it to your customer.
What I do with my website application is, that I include a .bat that fetches everything from my git repository, deploys my web application on an existing IIS-Server on the current computer (with 'aspnet_compiler -f -c -u -errorstack -v /web -p "source directory" -d "target directory"' and 'iisreset /noforce') and automatically imports the SQL tables to an existing MySQL Server (with mysql --host=localhost --user=user --password=password --database=database < Backup.sql).
Sorry for that general answer, but you're question really wasn't that precise.
If you want to create a setup of your project then,
Click on Build on the top of visual studio tab and then click on Publish "yourprojectname" click on it and your setup file will be ready.
Hope this helps you
Use LocalDB,
(no need to at least open sql server management studio)
When you create Setup file add prerequisite
.net framework version
sql server (2012 -2019) express localdb
Add connection string correctly!
So from what I can gather you are looking for an easy way to distribute your database schema to clients, is that correct? If so then I don't see how you could intend to run the setup without SQL Server (without VS is fine though).
Assuming my assumption is the case then I think you need to think about a solution that will handle schema upgrades as your project develops, in which case it's essential that you move to Database Projects in Visual Studio as it will handle upgrading the schema automatically, and allow you to run change scripts for the things it can't do automatically (like when you've changed a column type or removed a column etc).
Here are some links to get you started:
Working with Database Projects (MSDN)
Introducting Database Projects for Visual Studio (youtube)
Using the knowledge that CSPROJ files are just MSBUILD scripts at the end of the day you can now publish the database project during whatever your installation/upgrade system is using msbuild which is included in the .NET framework i.e. you don't need Visual Studio.
This is by far the most robust and reliable way of dealing with database deployment. I would advise staying well clear of automated tools like Redgate, they do a great job for small projects that maybe get used in an office etc but for professional software development you need more guarantees and control.
You can try this, with Octopus deploy.
Or, you can try with Code First migration
Have you already existing database, or development starts now?
I have spent several days trying to solve this problem with no luck and my requirements are really simple - I want to make an application with database which will work on most PCs (without DB server installed) and I want to use LINQ. For the compatibility reasons I want to use .NET framework 3.5 (every Windows 7 machine has it).
I have tried 2 ways: SQL Server CE and SQLite.
SQL Server CE
Although Visual Studio does not support LINQ for Compact Version of SQL server, I have found simple workaround - generating .dbml file using metal.exe tool from Visual Studio and then dragging it into project. My application works fine on my machine, but when I copy it somewhere else, it crashes. I have copied all dlls from C:\Program Files (x86)\Microsoft SQL Server Compact Edition\3.5 and tried 4.0 too. I think problem is that my app is not looking for dlls (references) inside its directory. I managed to get it work using DataSets (without LINQ), where I manually add reference to SQLServerCE and check CopyLocal to true. BUT when I use LINQ, there is no reference to SQLServerCE in project references and it is working. I don't know how to change it. Or is there a problem somewhere else?
SQLite
After long messing with SQL Server CE, I have tried SQLite. I am very disappointed how poor is SQLite support in .NET. I had to download older version of ADO.NET provider (newer versions does not add SQLite Database into my Visual Studio 2010 - I don't understand why but I googled that it is normal and I have to install old version and then replace it with newer). Then I downloaded dblinq (I have discovered that this project is dead later) and after some messing with dbmetal and dlls I get rid of errors in Visual Studio and compiled my application. But I can't run it, it always crashes on error 40 - like there was no SQLite server. Of course I have copied all dlls. I can't run it even on my development machine.
I am very surprised that it is nearly impossible to create simple database application in C# .NET which will not bother client with servers etc.
Please is there anyone who made SQL CE work with LINQ and mainly who made his app distributable?
I would suggest you try using the nuget Entity Framework for SQL CE package. It will download all the required assemblies to make it work.
http://nuget.org/packages/EntityFramework.SqlServerCompact/
I had used Server Explorer and related tools for graphical database development with Microsoft SQL Server in some of my learning projects - and it was a great experience. However, in my work I deal with Oracle DB and SQLite and my hobby projects use MySQL (because they are hosted on Linux).
Is there a way to leverage the database-related tools in Visual Studio with other database providers?
Here is instructions on how to connect to your MySQL database from Visual Studio:
To make the connection in server
explorer you need to do the following:
first of all you need to install the MyODBC connector 3.51 (or latest) on
the development machine (NB. you can
find this at
http://www.mysql.com/products/connector/odbc/
)
Create a datasource in Control Panel/Administrative Tools with a
connection to your database. This data
source is going to be used purely for
Server Manager and you dont need to
worry about creating the same data
source on your clients PC when you
have made your VS.NET application
(Unless you want to) - I dont want to
cover this in this answer, too long.
For the purpose of this explanation I
will pretend that you created a MyODBC
data source called 'AADSN' to database
'noddy' on mysqlserver 'SERVER01' and
have a root password of 'fred'. The
server can be either the Computer Name
(found in Control
Panel/System/Computer Name), or
alternatively it can be the IP
Address. NB. Make sure that you test
this connection before continuing with
this explanation.
open your VS.NET project
go to server explorer
right-click on 'Data Connections'
select 'Add Connection'
In DataLink Properties, go to the provider tab and select "Microsoft OLE
DB Provider For ODBC drivers"
Click Next
If you previously created an ODBC data source then you could just select
that. The disadvantage of this is that
when you install your project
application on the client machine, the
same data source needs to be there. I
prefer to use a connection string.
This should look something like:
DSN=AADSN;DESC=MySQL ODBC 3.51 Driver
DSN;DATABASE=noddy;SERVER=SERVER01;UID=root;PASSWORD=fred;PORT=3306;SOCKET=;OPTION=11;STMT=;
If you omit the password from the
connection string then you must make
sure that the datasource you created
(AADSN) contains a password. I am not
going to describe what these mean, you
can look in the documentation for
myodbc for that, just ensure that you
get a "Connection Succeeded" message
when you test the datasource.
I found this during my research on Sqlite. I haven't had the chance to use it though. Let us know if this works for you.
http://sqlite.phxsoftware.com/
System.Data.SQLite System.Data.SQLite is the original
SQLite database engine and a complete
ADO.NET 2.0 provider all rolled into a
single mixed mode assembly.
...
Visual Studio 2005/2008 Design-Time
Support
You can add a SQLite connection to the
Server Explorer, create queries with
the query designer, drag-and-drop
tables onto a Typed DataSet and more!
SQLite's designer works on full
editions of Visual Studio 2005/2008,
including VS2005 Express Editions.
NEW You can create/edit views, tables, indexes, foreign keys,
constraints and triggers interactively
within the Visual Studio Server
Explorer!
The Server Explorer should support any database system that provides an ODBC driver. In the case of Oracle there is a built in driver with Visual Studio.
In the Add Connection Dialog click the change button on the data source you should then get a list of the providers you have drivers for.
Oracle has a set of tools that integrates with Visual Studio. It's packaged with their data access libraries.
http://www.oracle.com/technology/software/tech/windows/odpnet/index.html