Acessing Remote SQL Server from Visual FoxPro Application - sql-server

Dear StackOverflow readers i would like your kind attention towards my one of the problem:
I have a Visual Foxpro application, in which i am accessing a remote SQL Server's Stored Procedure. Everything is working fine when I am installing the SQL Express 2008 in my Client Machine along with the FoxPro Application.
But when I am not installing the SQL Server On client Machine along with the visual FroxPro Application then I am getting a error " SQL Connect Error", Cannot Make Connection.
Is their any way that i don't have to install the whole SQL Express on client machine and i can only install the required libraries.
Regards
ProgChd

You should not have to install SQL Express itself, but at least ensure that you have the ODBC / OleDB providers for SQL Express. These can use SQL-Server connection which are somewhat common to already be on the machine.
As for your connection string, are you connecting via the fully qualified \server\database hosting information?
Just for grins, you could go through the machine's
Control Panel
Administrative Tools
Data Sources ODBC
and try to manually create an ODBC connection to the SQLExpress server you are trying to do via your VFP application. If you can't connect through that, then neither will VFP. Take the VFP app out of the equation and just test for the connection.

Related

Cannot connect to SQL Server localDB through ODBC

Everything was working fine until I made a few changes (including installing VS 2022), and I can't figure out which change caused the problems.
I connect an access front end to a local SQL server through ODBC. I do this on a number of computers (then sync the databases through azure). Some are regular SQL Express instances, and some are LocalDB.
The computer that stopped working is one that uses LocalDB. The entire instance got corrupted. After I was able to delete the instance and recreate it. I can now connect through Azure Data Studio, and Visual Studio, etc. I just can't connect through ODBC. I've tried all of the different drivers including SQL Server Native Client 11.0, ODBC Driver 17 for SQL Server, and more. None of them work.
What does work, is if I use the named pipe url directly in the server section of the ODBC setup. So instead of putting (localdb)\MSSQLLocalDB I put np:\.\pipe\LOCALDB#D26172B4\tsql\query. That does work, but the instance id in that URL changes every time the instance starts. So every time the computer restarts we need to create a new ODBC connection. That is not a maintainable solution.

Deploying Windows application with SQL Server database

I have a WPF project and I will use SQL Server database. The instance of SQL Server IT created for me is SQL Server 13 (2016 standard version) on a remove server. When I’m deploying the application on a client’s computers, what version I need to install there as a prerequisite? Can I deploy SQL Server Express 2016 on a client’s computer and access the remove SQL Server Standard edition? I am looking for a simple solution and for a lighter version I need to install on the user’s computers. I cannot install a full SQL Server on each user.
I have searched the net and a similar question has been asked many times, but I didn’t find a clear answer before. Many people started their SQL Server experience using local type databases, like SQL Server CE or LocalDB. In this case specific DLLs and redistributables must be added with the installation program. It is hard to understand at the beginning, but when an instance of SQL Server is on a remote server, this is a different story. Everything is happening on this remote server. There is no need of any SQL Server instances on a client’s machine. Just a connection string must be added. The adapter or Entity Framework will take care of everything else.

Can a WPF app with .sdf database run on a computer without SQL Server installed

This question may seems a bit silly. The thing is I'm programming a WPF using VS2010, which contains a .sdf database (connection is ADO.NET).
Someone told me that if I use a SQL Server Express database it can be run on any PC even it has no SQL Server installed. But after I tried executing in my virtual machine (win7 & win xp), seems it cannot even start up.
So, can someone brief me, what database do people normally use in developing WPF software? Is it true that my program using a SQL Server database file cannot execute on PC without SQL Server installed?
Much appreciate in advance!
Yes, it can!
SQL Server Compact (that produces and uses .sdf) is the only SQL Server edition that does not require a server to be installed. All its code and logic is contained in the handful of DLL's that you need to include with your application. Just ship your app with those DLL's and you should be fine.
Read more about SQL Server Compact and how to use and deploy it on MSDN.
SQL Server Express (and any of the other editions, like Web, Standard, Developer, Enterprise) on the other hand does require an installation of the SQL Server Express edition - either on that machine, or somewhere in the network where your app runs (remote connections from the network are disabled by default, but can be enabled).

SQL Server using SSH-tunnel from Visual Studio

I recently contacted a web host regarding support for external database access to a Microsoft SQL Server database included in a package they offer. They replied saying that it is only possible with an SSH-tunnel.
Is it possible to connect to a SQL Server database in Visual Studio using an SSH-tunnel? It is important for me to be able to access the database from my local machine (for debugging, generating LINQ classes, editing tables, etc).
Or, how should I go about working with their database?
Accessing a database via an SSH tunnel works exactly the same as accessing any other database.
So, if you set up an SSH tunnel from the SQL Server machine to localhost:some_port, it's just about using that URL in Visual Studio.

Asp.net MVC database connection setting in Visual studio 2008

I am trying to learn Asp.net MVC framework. I was looking at the video tutorial at the link below
http://www.asp.net/learn/mvc-videos/video-395.aspx
In this video the very first step is to add a new database to the example application.
I have visual studio installed on my development machine but the SqlServer Express is running on a different machine, so when I try and add a new database following the same steps as the video I get the following error
"Connections to SQL Server files(*.mdf) require SQL express 2005 to funciton properly. Please verify the installation of the component or download from the url"
I am assuming this is because Visual studio is looking for an instance of SQL express on my local machine and since it doesnt exist on the local machine,it errors out.
So how do i tell visual studio, to connect to a different machine and create the database there?
I am using Visual studio 2008 with .net 3.5 Sp1
Make sure that remote connections is enabled in your sql server express installation (http://www.linglom.com/2007/08/31/enable-remote-connection-to-sql-server-2005-express/). Then take a look at www.connectionstrings.com for the various ways to connect to the sql server as appropriate for your environment. Then configure the connectionstrings section in web.config and reference that configuration target when connecting to the db.
Alternatively you might try using LINQ to SQL which will streamline some of these tasks (still need to enable remote connections and get an appropriate connection string defined...LINQ to SQL wizard for the rest).
Open the Server Explorer and add a new Data connection. Same thing as adding a new .mdf. You can use it just the same.
create the database on the remote computer(edit: IIRC, you can also create it within visual studio when you add the connection)
ensure that it allow remote connections
add the connection in database explorer
I'm not sure what's happening in that video, but if you for instance are going to use linq2sql, visual studio will add the connectionstring to web.config when you drag the tables into the .dbml :)
What you'll have to do is attach the mdf to the database server you have running on your separate machine, and then open up your server explorer and navigate to that particular machine and select the database from there.
I am not going to see the video so I can't tell you what step to change. But it should be easy enough to write a connection string (or get it off the web) that connects to a database on the remote computer and not your PC.
I am so used to writing my own connection strings that I don't even know of any option in VS that automates this.
Instead of add a new database to a remote machine as you indicated on your local machine, you can try to create the database on the remote machine firstly, and then connect to that remote database within your visual studio.

Resources