In my product we are using OSQL to execute the sql script files. Unfortunatly some clients don't have OSQL installed in their machine. They don't agree to install sql management studio for license issues.
Is there any alternative to execute the sql scripts rather than OSQL through c# ?
SQLCMD.EXE will be installed in the SQL Server binn directory on the server. You will need SQLCMD.EXE on the client, where your application runs. You can install the SQLCMD.EXE and other command line utilities separately, see Microsoft® Command Line Utilities 11 for SQL Server®.
But is not necessary to install SQLCMD, writing a C# script executor is fairly trivial. In fact I wrote one myself, see https://github.com/rusanu/DbUtilSqlCmd and is also available as a NuGet.
I think SSMS is free for download from microsoft portal and there are no licence issues with it. Check this
Related
I have create a Windows application in WPF using Visual Studio 2013, and I'm using MySQL as database, now I want to include MySQL as a distributable package in my setup file.
I am new to development and have very little idea about deploying the software, and i have been searching over the internet but hardly finds any good article which explains the steps to perform the task.
A MySQL database is supposed to be setup on a (remote) database server that the client applications connect to. You don't (or at least you shouldn't) set up a server on each workstation where your client application is installed on.
What you probably want is a self-contained database that can be shipped with your application and run "as-is" without any remote servers or specific setup.
SQLite is a popular example of such a database.
Getting started with SQLite in C#: http://blog.tigrangasparian.com/2012/02/09/getting-started-with-sqlite-in-c-part-one/
Use this:
https://marketplace.visualstudio.com/items?itemName=UnniRavindranathan-MSFT.MicrosoftVisualStudio2013InstallerProjects
And then follow this:
http://geekswithblogs.net/TarunArora/archive/2014/04/24/visual-studio-2013-installer-projects-ndash-hello-world-installer.aspx
There will be settings which you will be setting when creating installer with the wizard, one will be like pre-requisites for the program and will ask you for a MSI location for that program. Dump the location of your LocalDB or whatever MySQL software that you are using (Popular ones are SQLite/SQL Server Express). When the user starts to install the program it will make them install your SQL prerequisite software before moving onto installing your program.
I created a c# program which relies solely on .NET and SQL Server. What do the end-users need to install in order to use my program? I know they have to install .NET Framework but I'm unsure if the program will work without the appropriate SQL files. or am I wrong?
I'm sorry if this question is rather misguided but this is my first program.
If your application is using SQL Server you will need to install SQL Server AND the database your application is looking for.
.NET Framework does not include SQL Server but SQL Server will install the .NET Framework. (SQL Server 2016 installation)
SQL Server 2016 Express had a LocalDB version that may suit your needs. LocalDB is a lightweight version of Express that has all its programmability features yet runs in user mode and has a fast, zero-configuration installation.
Good luck with your first program. :-)
I need to execute an SSIS package from an .net application that's on a remote machine. The machine running the application does not have SSIS installed.
I know this can be accomplished using T-SQL with xp_cmdshell http://www.databasejournal.com/features/mssql/article.php/3372131/Using-xpcmdshell.htm but am unable to use this approach because of security issues.
I would like to put store this package as an Agent job on the remote server (running sql server 2008) and execute it though the Agent service. I found an article about that here http://msdn.microsoft.com/en-us/library/ms403355.aspx#agent but am unable to find out how to pass the package in variables.
These variables will change from each run and I know I could store them in the database and load them while executing the package but it seems a hacky solution. Is anyone aware of a work around for this?
Have you considered/read about package configurations? You may want to read that if you have not done so already. Also, read about the DTEXEC utility which is the command line SSIS executable. You can easily pass variables through a batchfile and DTEXEC utility.
Can the SQL Server Import/Export wizard be called from our windows application?
The data import/export wizard is an external app called "DTSWizard.exe", which lives somewhere in your SQL Server installation directories.
In my case, on a 64-bit system with SQL Server 2008 R2 CTP installed, I find it under:
"C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\DTSWizard.exe"
for the 32-bit version
or
"C:\Program Files\Microsoft SQL Server\100\DTS\Binn\DTSWizard.exe"
for the 64-bit version
You can definitely store those locations in some config file and then execute those from a Winforms app.
Marc
The wizard generates an SSIS package. You could save and use that in your application and use variables etc to control it (example: a filename chosen by the user).
Otherwise, you have absolutely no control over what data goes where in the wizard. Surely the load or export functionality of the application is in the context of what makes sense for you app, not do anything and drop it anywhere?
I am guessing here but I think that Import\Export wizard from SQL Managament Studio is simply a wrapper for command line tool called bcp.exe.
There is a lot information about bcp on the Internet so I will provide only one link here:
http://msdn.microsoft.com/en-us/library/ms175937.aspx
I have created an Windows application.
I used
FRONT END : C# (VISUAL STUDIO 2008)
BACK END : MICROSOFT SQL SERVER 2008
.NET FRAMEWORK : 3.5
Now after deployment when I am installing the application in my Clients machine is it necessary to first install .Net Framework, VisualStudio2008 and Sql Server 2008 before installing Application?
And in which module of building my set up file(FileSystem Editor, Registry editor etc..) should I attach the DataBase?
This is my first application of deployment so please help me out with tips and tracks for deployment?
Thanks in advance!!
You customer will not use Visual Studio, so you don't need to install it.
You will need to install SQL Server manually. You cannot have your setup project install it automatically. Just install SQL Server 2008 (SP1 or higher). I believe this will install all or most of .NET 3.5 for you. If not, then when your setup is run, it will install any other parts of .NET that are needed.
BTW, be sure to test the installation steps on a clean system of your own (maybe on Virtual PC) before trying it on your customer's site!
It depends if you want every client to have SqlServer installed locally (usually, on an Enterprise scenario, you have already a server box with Sql Server running, and you just need to deploy your database there).
If having Sql Server running locally is a requirement, you might want to take a look at this thread which will help you: How to install a custom desktop application database to SQL Express?
You should install SQL Server manually before installing your application.
You just need to install you application, you do not need visual studio. If you use a setup project to do this it should detect that it requires the .Net framework and give the user the option of installing it.
You don't have to install the Visual Studio. For running .Net applications, you only require .Net Framework. And for SQL 2008 also .Net required. And for Database, either you have to run SQL Script or you may need to restore the database. Running SQL Script is better I think, you can do it via a Batch file.