Help setting up ADO.NET connection in VB.NET

C

Carlos

Need help with setting up data connection in ADO.NET. Checked message
boards but have not found solution. Any help would be appreciated.
Here is my situation:

BACKGROUND: I'm using Visual Basic.NET Standard 2002 on XP Pro
running MSDE (the one that came w/ Visual Studio).

Here is the problem: when setting up a data connection, I am able to
see the MSDE SQL server running on my local machine form the Server
Explorer. The connection seems just fine, since I can browse all
tables, see all their contents, etc.

The problem begins when I try to creat the ADO.NET connection. I drag
one of the tables onto a form, and VS begins generating the connection
code. However, an error comes up and reports that "SQL Server does
not exist or access denied". Afer investigating, I've tried the
following changes to my connection string settings, but to no avail:

1. VS configured the SQL Server on my machine (SJ-CGONZALEZ) with the
following name SJ-CGONZALEZ\VSdotNET. I edited the connection string
to include an escape character for the "\" that appears. In other
words, connection string became: data source=SJ-CGONZALEZ\\VSdotNET.
It didn't work.

2. I tried using named pipes instead of tcp-ip, adding the following
to the connection string: net=dbnmpntw. That didn't help.

3. I tried doing points 1 and 2 a the same time, but it didn't work.

What should I be trying next? Any help would be greatly appreciated.

Thanks,
Carlos
 
V

Val Mazur

Hi,

What do you mean "data connection"? Is it same application? Is it ASP .NET
application? Looks like you do not have permissions to connect to the
database
 
C

Carlos Gonzalez

Val,

I am trying/learning to make a Windows Application that will connect to
a database. What I mean by "Data Connection" is that the Server
Explorer within Visual Studio is able to see and explore my SQL server
(on local machine). That leads me to believe that the config problem is
not with my server but with the VB code in my application.

The problem begins when I try to generate the VB code so that my
Application will be able to make the connection, create the data
adapter, and then generate a data set. I let Visual Studio generate
the connection code (connection string, etc.). The problem, I assume,
is in the code that is being generated. That is why I have tried the
two changes I detailed in the original email.

Also, I've tried changing the login from Windows Login to SQL Login, but
have had the same problem present itself.

I'm a bit of a beginner at VB.NET, so I appreciate your patience and
help.

Thanks,
Carlos
 
V

Val Mazur

Hi,

Could you post full connection string? Actually you should not escape \
character. This way SQL Server distincts named instances
 
C

Carlos Gonzalez

Val, this is the full connection string:

"data source=SJ-CGONZALEZ\VSdotNET;initial catalog=Holdings;integrated
security=SSPI;persist security info=False;workstation
id=SJ-CGONZALEZ;packet size=4096"

Like I said, this is generated by VS automatically. I've tried
different configurations (SQL login, Named Pipes), which result in
different connection strings, but none have worked.

Thanks for your help!

-Carlos
 

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