VB Express SQL Express Remote Connection

G

Guest

I am migrating from VB6/Access to Visual Basic and SQL Express. I have
success writing test code on my local machine and am now setting up tests for
deployment to a server. I have installed SQL Express on a Windows 2003
Server. I can connect and create databases on the Remote Server from my
local machine using SQL Management Express, so I know Remote Access is
working.

However, I am unable to connect using a connection string within my VB
Express program. I am using the SQL Connection String Builder with the
properties

Dim cn as SQLClient.DBConnectionStringBuilder = new
SQLClient.DBConnectionStringBuilder
cn.DataSource = "AppServer02\SQLExpress"
cn.ApplicationName = "VBTest"
cn.AttachDBFilename = "testdb.mdf"
cn.IntegratedSecurity = True
cn.PersistSecurityInfo = False

The error I receive is
When connecting to SQL Server 2005, this failure may be caused by the fact
that under the default settings SQL Server does not allow remote connections.

I understand that VB Express does not support Remote Connections through the
Designer, but I thought I could connect to a remote database using a
connection string.

Your help is appreciated
 
G

Guest

Thanks for the response
I'm sorry but I can't access the link you provided. Can you provide me with
some additional information or a different link.
 
C

Cor Ligthert [MVP]

Cleo,

Can you tell me why you cannot access that link?

Because it is the website from Ken and me.

Thanks in advance

Cor
 
G

Guest

I just receive the general error "This Page cannot be displayed." I get it
when I click on the link and when I google into vb-tips.com. I am using
Windows XP and Internet Exployer
 
C

Cor Ligthert [MVP]

Cleo,

Thanks for your information one other question?

Do you use a proxy or whatever like that?
--------------------------------------------------------------------------
There is not so much text on that page by the way, it is this.

This sample is usable for more than only the Faq, but you can make that
sample yourself.
--------------------------------------------------------------------------------

Open a new project.

Click on Data -> Add New DataSource and follow the wizard
Click on Data -> Show Datasources
Drag from the at the left opened window your table to the form
Set in Solution Explorer the Show All files Icon to show all files

You have now a lot of samples with a strongly typed dataset

Cor
 
G

Guest

I am receiving the general error This Page cannot be displayed. I receive
the error when I use the link and when I google vb-net.com. I am using
Windows XP and Internet Exployer
 
G

Guest

Sorry for the double post. No I don't use a proxy.

I have added typed datasets using a local SQL Server Express instance -
these all use the Data Source=.\SQLEXPRESS and work fine. But now I want to
connect to a production Server instance named AppServer02\SQLEXPRESS. The
Add Data Source Wizard errors with the message The file
\\AppServer02\SharedDatabases\textdb.mdf is on a network path that is not
supported for database files.

Will VBExpress allow me to connect to a SQL database that is not local?

thanks for you time.
 
C

Cor Ligthert [MVP]

Cleo,

Can you install this tool and than try to attach the file to the database
server

http://msdn.microsoft.com/vstudio/express/sql/download/

You are now using it in a kind of Access way.

I don't use that tool, but as you have done that, than your connection
string becomes something as

strConn = "Server = YourServerName/SqlExpress;Database = NorthWind;
Integrated Security = SSPI;"

I hope this helps,

Cor
 
G

Guest

Yes I can connect using the SQL Server Management Studio Express Tool.
I changed my connection to exactly what you specified and it connected.
Then I went back to my original connection string - All I had to do was
change Integrated Security = True to Integrated Security = SSPI and it works.

Thank you.
 
G

Guest

Cor, I tried the link to your site from my home. I was successful.
Thanks for all your help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top