0

I am trying to develope a basic sql database driven application using visual basics 2010 Express. An application which can be used on all pc's connected to the network.

We have a small company network and the server is running SQL-server 2008 express. On this networkserver I have already created a database to connect to and use in my VB-application.

I am running Visual Basics (VB) on my local client, not on the network-server, my local client is connected to the network-server. I succeeded in adding the database to my application. But when I try to access the database insided VB, VB gives me the follwing message:

Title of message: 'Required Components Missing' Message: 'Connection to SQL Server database files (.mdf) require SQL Server 2005 Express or SQL Server 2008 Express to be installed and running on the local computer. The current version of SQL Server Express can be downloaded at the following URL: http://go.microsoft.com/fwlink/?LinkId=125883 '

It seems that i need to install SQL Server Express on my local machine.

My Question: Will installing SQL Server Express on my local machine cause any problems on the network or on my local machine? I dont want it corrupt things. On every local client, including mine, we have administrative software running which uses the SQL Server which runs on the networkserver. Maybe I can get advice how to prevent problems.

Greetings,

Ferdinant

1 Answers1

0

You do not need to install SQL Server on the client machines.

Based on the error message, I'm guessing that you're trying some sort of direct access to the MDF file, which is not necessary. Here's a simple template in VB.NET for database access, assuming that you've got .NET 2.0 or later...

Using cnn As New System.Data.SqlClient.SqlConnection("Server=SERVERNAME;Database=DBNAME;uid=SQLLOGIN;pwd=SQLPASSWORD")
    cnn.Open()
    Using cmd As System.Data.SqlClient.SqlCommand = cnn.CreateCommand
        cmd.CommandType = CommandType.Text
        cmd.CommandText = "SELECT * FROM MyTable"
        Using dr As System.Data.SqlClient.SqlDataReader = cmd.ExecuteReader
            '' loop through reader and do stuff
        End Using
    End Using
End Using

This example assumes that your SQL database is configured for SQL Authentication. The connection string would be a little different if you're using Windows Authentication.

DWRoelands
  • 4,878
  • 4
  • 29
  • 42