473,387 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Is it Possible to connect to SQL 2005 Ex from VB 2005 Ex code?

Is it possible to connect to a SQL 2005 Express db using Visual Basic 2005
Express?

I cannot get past the connection.open statement without the error
"...Version=2.0.0.0; SqlClient.SqlClientPermissions;
PublicKeyToken=b77a5c561934e089 failed."

I have WinXP, SQL Express 2005, and VB 2005 Express all on same machine.
I've found hundreds of samples and tried most of them, but still get same
error.

I would like to publish the code and install on another computer that will
access this computer for the database, but I can't even get it to work on
this one.

Any help would be greatly appreciated, Thanks in advance.

Here are some of the connection strings I've tried:

'*********sql client*********************
Protected Const SqlConnectionString As String= _
"Data Source=localhost;" & _
"AttachDbFilename='R:\dbFileName.mdf'; & _
"Integrated Security=True;" & _
"Connnect Timeout=30;" & _
"User Instance=True;"
Protected connection As String = SqlConnectionString

Dim connection As New SqlConnection(connectionString)
connection.Open()
'**************************************
(I've also tried replacing the line "Data Source" with
"Server=MyCompterName;
and "Server=tcp:MyComputerName;" and "Server=MyComputerName,port"
and "Server=MyComputerName\SQLEXPRESS"
And I've tried removing the line "AttachDbFileName or replacing it with
"Database=dbFileName"
and removing the line "Connect Tiimeout" and "User Instance"
)

'***********ole client************************
Protected Const SqlConnectionString As String= _
"Provider=SqlOledb.1;" & _
"Data Source=MyComputerName; & _
"Integrated Security=SSPI;" & _
"Persist Security Info=False;" & _
"DataBase=dbFileName;"
Protected connection As String = SqlConnectionString

Dim connection As New OleDbConnection(connectionString)
connection.Open()
'********************************************
(I've tried removing the "Persist Security Info" also)

Dec 1 '05 #1
1 4063
Solved --- maybe...

2 things I did:

1. set the Access Security Policy of LocalInternet Zone to Full Trust -
using Configure Code Access Security Policy Wizard in .Net Framework 2.0
Configuration

2. published the VB 2005 Express and installed on my computer and 2nd test
computer and the installed program worked - Previously I was just running
Debug on my computer.

I don't know which method worked or if I needed to do both.

"Wade" <wn********@preinnewhofdonotreply.com> wrote in message
news:uS**************@TK2MSFTNGP11.phx.gbl...
Is it possible to connect to a SQL 2005 Express db using Visual Basic 2005
Express?

I cannot get past the connection.open statement without the error
"...Version=2.0.0.0; SqlClient.SqlClientPermissions;
PublicKeyToken=b77a5c561934e089 failed."

I have WinXP, SQL Express 2005, and VB 2005 Express all on same machine.
I've found hundreds of samples and tried most of them, but still get same
error.

I would like to publish the code and install on another computer that will
access this computer for the database, but I can't even get it to work on
this one.

Any help would be greatly appreciated, Thanks in advance.

Here are some of the connection strings I've tried:

'*********sql client*********************
Protected Const SqlConnectionString As String= _
"Data Source=localhost;" & _
"AttachDbFilename='R:\dbFileName.mdf'; & _
"Integrated Security=True;" & _
"Connnect Timeout=30;" & _
"User Instance=True;"
Protected connection As String = SqlConnectionString

Dim connection As New SqlConnection(connectionString)
connection.Open()
'**************************************
(I've also tried replacing the line "Data Source" with
"Server=MyCompterName;
and "Server=tcp:MyComputerName;" and "Server=MyComputerName,port"
and "Server=MyComputerName\SQLEXPRESS"
And I've tried removing the line "AttachDbFileName or replacing it with
"Database=dbFileName"
and removing the line "Connect Tiimeout" and "User Instance"
)

'***********ole client************************
Protected Const SqlConnectionString As String= _
"Provider=SqlOledb.1;" & _
"Data Source=MyComputerName; & _
"Integrated Security=SSPI;" & _
"Persist Security Info=False;" & _
"DataBase=dbFileName;"
Protected connection As String = SqlConnectionString

Dim connection As New OleDbConnection(connectionString)
connection.Open()
'********************************************
(I've tried removing the "Persist Security Info" also)

Dec 1 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: JenU | last post by:
Hi! Running DB2 Connect EE 8.1 on Windows 2000. When we execute a web app with a small amount of data returned, we do not have a problem. But, when we widen the criteria, we get errors... web...
3
by: Abhimanyu Sirohi | last post by:
I want my WebService to call a client's function whenever it receives a message from any of the client. A way of notifying all clients when any of the client send a message to the web service.
2
by: geno | last post by:
Hello, When using VB.Net to connect ot a web service, I am getting the error The underlying connection was closed: Unable to connect to the remote server What could be causing this? ...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
13
by: josh | last post by:
I'm pretty new to both sql 2005 and VB but please bear with me. I have installed SQL 2005 express on a Windows 2003 Standard server. I have also installed VB 2005 Express edition on the server. SQL...
2
by: cheer | last post by:
HI,there I use the VS 2005 EXPRESSION VERSION to develop and the database is SQL 2005 . Especially ,it is not the SQL 2005 expression version . I can not find the data connect for SQL 2005 ......
9
by: Gabriel | last post by:
Hello, I installed SQL server 2005 SP1 on a Windows XP SP2 From Visual Studio, I'm trygin to create a connection to a database, but I receive this error but I'm creating the connection (I...
8
by: BD | last post by:
I am developing C# win form app to work with remote database on SQL Server 2005. Problem scenario is as follows: 1. a form is open that has downloaded dataset to local cache 2. computer is...
3
nev
by: nev | last post by:
Good morning sirs and madams, how do we connect vb 2005 to ADABAS? Can this be done? Thanks in advance.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.