Vb app set up with database - sql-server

Is it possible to make a setup installation of vb.net app including the database.
My database is SQL Server 2008. I've made a vb.net system and i just need to install it but the problem is im not the one who will install it . And so i figured out cause i try it once that i need to install sql server so that it would connct to the database, but the thing is i cant just tell them to nstall the sql server first and instruct to transfer the data and such.
Another thing is that it will be installed in different computer and so when i just use simple sql server, of course the connection of data source should be change and i cant possibly do that since they only want one installer.and what if they change their computer and cant i cant possibly always change the data source of connection.
WHat could be the other way to make a setup where i dont need to install sql server in a computer. A vb app where the setup contain the system and database that can easily be install.I already try installing it and ive already search or an answer and i still cant find one but is still hoping for a clear and detailed answer.

Related

SQL Server/Access Connection Ongoing Maintenance on Different Server

I am working on building a database through SQL Server. I am going to link it to Microsoft Access so that others can easily view and manipulate the data.
I am only at this place for a temporary amount of time, so I need to make sure that someone else in the office can maintain the database once I am gone. If I am only able to use my own personal computer server, is there any way for me to send the entirety of my work to someone else? Or will they have to recreate everything on their own server?

BIML OLE DB connection uses the wrong database (sometimes)

I'm using BIML to interrogate the schema of the source and destination databases, check that everything is configured correctly, and then generate a bunch of SSIS packages. My issues is that occasionally the OLE DB connection starts using the Master system database instead of the one I've specified in the connection string. I can tell it is the master database by examining the tables that get returned.
I define the connection using BIML markup:
<OleDbConnection Name="appdb" ConnectionString="Server=<#=ReplicationConfig.appdbHostname#>;Database=<#=ReplicationConfig.appdbDatabaseName#>;Integrated Security=SSPI;Provider=SQLNCLI11;" CreateInProject="true" />
I've hit the issue mostly when trying to use the GetDatabaseSchema() method of the OleDbConnection object on the BIML root node. Though I have also run across it when trying to use an Execute SQL task. It was easy to work around with the Execute SQL task because I could fully qualify the table with [DatabaseName].[schema].[Table] but I don't have that option with the GetDatabaseSchema() method. I've also tried using ImportDB() and GetTableNodes() and they both experience the same issue.
When trying to migrate my solution from the development environment to test the issue has cropped up again. In the past this has been fixed by restarting Visual Studio (or working around it in the SQL query). However, that hasn't worked this time.
I'm using BIML Express with Visual Studio 2015.
Does anyone have any idea what could be wrong or how to get around this?
I ended up working around the issue by setting the default database for my login to the one that I needed to work with. For some reason BIML seems to be ignoring the database specified in the connection string.

Sharing database project in TFS

I created a database project as part of my solution with scripts for my tables. I'm using database first, so all I do is run the project to build/deploy my tables to the database.
I'm working with a few others so I checked the SQL project into TFS.
So the other people can get the solution, run the SQL project and generate the local database for themselves.
The problem is, it might generate them under another local instance. For instance, on my home computer, it generated it under (localdb)\Projects, but on my laptop, under (localdb)\ProjectsV12.
This breaks the connection strings (which of course can be fixed). But this leaves me wondering, is there a better way to develop the SQL project collaboratively?
If you have the SQL code under source control then everyone can open that solution to edit/create copies of the database. Ideally you have an automated process but that does not work for local dev.
Since sharing code is a bad idea and you have expressed that the database is used by more than one solution I would consider packaging and distributing it.
If you create a SSDT database project you can compile your database into a package that can upgrade any instance. You can then share that .dacpac output easily.
You might even what to share it with Nuget so that each dependency is automatically updated.
You can setup a SQL alias name to standardize the connection string across developer machines.
Alias .\SQLEXPRESS to (LocalDB)\MSSQLLocalDB

Can I dump an entire Microsoft SQL Server database from Linux?

I've got a linux server that already connects happily to a MS SQL Server and I want to know if there is a way to dump the whole thing into a format I can read. I don't have access to the desktop, but I can connect using PHP and I can issue whatever commands I want. I have admin access to the SQL Server, so no problem there.
My main goal is to understand how the people before me set this thing up. I already know how to get the stored procedures as text (SELECT * FROM sys.procedures), but I was wondering if there is a way to get the whole database. I'm not very familiar with SQL Server so I don't know what important bits I might be missing.
And I don't care if the solution is in PHP or not. That's just the thing I've got working right now. Any SQL-ish command that dumps the entire database would solve my world.
To summarize:
I don't have access to the actual machine/desktop
I have admin access to the DB using PHP's mssql libs
I'm on linux
I want a text file I can look at that tells me everything in the database
My goal is not to answer a specific question - I'm looking to understand what the people before me did when they set up this database. Unknown unknowns, and all that.
Okay, hopefully I've made sense. I'm sorry if I've been a complete idiot. Be gentle. Thanks!
I would backup (http://msdn.microsoft.com/en-us/library/ms186865.aspx) the database to file and then download it, restore it on Windows and then use SQL Server tools like SQL Server Management Studio etc. to look at it.
There is plenty you can do with the metadata, but you could spend a lot of time writing queries instead of using existing off-the-shelf documentation tools.
You can use this script to create insert statements for any given table.
This stackoverflow question will tell you how to generate create table statements.
SELECT NAME FROM sys.tables will give you a list of table names.
You would probably save a LOT of time and pain by just using native SQL SErver Windows tools that work with it.

Database Versioning Using Visual Studio

In the SO podcast episode 54 Jeff talked about using Visual Studio to save all the database objects to individual files. This sounded like just what my team needed to better implement database schema changes into TFS and I told my lead about it. He thinks it's a great idea to.
Unfortunately, so far I've had no luck getting this to work for me. One of my problems is that I don't have SQL Server installed on my local box (dept policy). I'm obviously doing something wrong.
Can someone give me a rundown of the steps or provide a decent link?
Thanks!
1) Create a connection to the database in Server Explorer.
2) Right-click on the connection and select Publish to provider...
3) Next, Script to file, Next, Types of data to publish should be Schema (unless you need some initial data), finish.
4) Add script to the project and check into source control.
He was referring to a project type in VS that supports managing databases, including (if you set it up correctly), versioning your database publishes.
Check out this article on Database Projects in VS
You want to use the GDR 2. (Sometimes called Data Dude)
This allows for a completely offline solution. You don't need to have SQL Server installed on your machine for this to work. (In fact the GDR is the first version that does not care if you have SQL Server installed.)
I use the GDR for my db (a team of 3 devs and 2 testers) and it works GREAT!
Here is a link for the GDR 2 release:
http://blogs.msdn.com/vstsdb/archive/2009/04/21/microsoft-visual-studio-team-system-2008-database-edition-gdr-r2.aspx
And this is a link to the actual bits:
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=bb3ad767-5f69-4db9-b1c9-8f55759846ed
The basic use is to import from an existing DB and server. (You will probably want a server project and 1 or more DB Projects)
You can then make your changes off line. When you are ready to send you changes back to the DB you can delploy (make sure you set up your deploy options first as I think the default is to drop the db and re-deploy). You can also do a Data->Schema Compare in Visual Studio and comapre your project to your database then get a script of changes from the diff output.
It takes a bit of work, but it really allows great source control and is easy once you get the hang of it. (I have my db auto deploy in my night time build twice a week.)
If you're importing an existing database schema, its important to get the right database project. You should likely be using "Database Projects\SQL Server 2005 Wizard".
Visual Studio requires a database connection it can use to create temporary copies of the databases it is working with. It sounds like this is the issue. Do you have SQLExpress on your local box? Use that as the deployment target (server name would be .\sqlexpress if . does not work).
As an alternative, grab update GDR 2 for Visual Studio. Allegedly, it allows one to work with database projects without using a local instance of sql server to deploy temporary working copies of the database.

Resources