473,836 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.SqlCl ientPermissions ;
PublicKeyToken= b77a5c561934e08 9 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 SqlConnectionSt ring As String= _
"Data Source=localhos t;" & _
"AttachDbFilena me='R:\dbFileNa me.mdf'; & _
"Integrated Security=True;" & _
"Connnect Timeout=30;" & _
"User Instance=True;"
Protected connection As String = SqlConnectionSt ring

Dim connection As New SqlConnection(c onnectionString )
connection.Open ()
'************** *************** *********
(I've also tried replacing the line "Data Source" with
"Server=MyCompt erName;
and "Server=tcp:MyC omputerName;" and "Server=MyCompu terName,port"
and "Server=MyCompu terName\SQLEXPR ESS"
And I've tried removing the line "AttachDbFileNa me or replacing it with
"Database=dbFil eName"
and removing the line "Connect Tiimeout" and "User Instance"
)

'***********ole client********* ***************
Protected Const SqlConnectionSt ring As String= _
"Provider=SqlOl edb.1;" & _
"Data Source=MyComput erName; & _
"Integrated Security=SSPI;" & _
"Persist Security Info=False;" & _
"DataBase=dbFil eName;"
Protected connection As String = SqlConnectionSt ring

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

Dec 1 '05 #1
1 4085
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********@pre innewhofdonotre ply.com> wrote in message
news:uS******** ******@TK2MSFTN GP11.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.SqlCl ientPermissions ;
PublicKeyToken= b77a5c561934e08 9 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 SqlConnectionSt ring As String= _
"Data Source=localhos t;" & _
"AttachDbFilena me='R:\dbFileNa me.mdf'; & _
"Integrated Security=True;" & _
"Connnect Timeout=30;" & _
"User Instance=True;"
Protected connection As String = SqlConnectionSt ring

Dim connection As New SqlConnection(c onnectionString )
connection.Open ()
'************** *************** *********
(I've also tried replacing the line "Data Source" with
"Server=MyCompt erName;
and "Server=tcp:MyC omputerName;" and "Server=MyCompu terName,port"
and "Server=MyCompu terName\SQLEXPR ESS"
And I've tried removing the line "AttachDbFileNa me or replacing it with
"Database=dbFil eName"
and removing the line "Connect Tiimeout" and "User Instance"
)

'***********ole client********* ***************
Protected Const SqlConnectionSt ring As String= _
"Provider=SqlOl edb.1;" & _
"Data Source=MyComput erName; & _
"Integrated Security=SSPI;" & _
"Persist Security Info=False;" & _
"DataBase=dbFil eName;"
Protected connection As String = SqlConnectionSt ring

Dim connection As New OleDbConnection (connectionStri ng)
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
1687
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 app shows: Exception caught in TFBDB, DoDB2Dataset - DotNet Provider. Exception Message - SQL1224N A database agent could not be started to service a request, or was terminated as a result of a database system shutdown or a force command....
3
1785
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
1701
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? Thanks!
14
7047
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 sql server resides on is not reachable. The error is different depending on the connection string that I use. If I use the following connection string: "server=192.1.1.1; Initial Catalog=master; uid=The_User; password=The_Password; Connect...
13
2121
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 seems to be running fine (I can create databases, tables, modify them, etc.) I have created a very basic app in VB express that just lets me view and modify the current tables. It works just fine on the server. However, I am trying to make...
2
1165
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 ... It is true?? thanks
9
2626
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 don't receive the database list in the dropdown) "An error has occured while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that
8
2841
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 put into stand-by or hibernation 3. later, computer is brought out of stand-by or hibernation 4. when trying to save or close form, SQL exception comes up (remote system closed conn) I know this relates to connection pooling, but I am having a...
3
1916
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
9810
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9656
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10819
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10526
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10567
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10237
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6972
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5641
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4000
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.