473,513 Members | 2,419 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question with udl and connection string does it work? TIA Sal

sal
Greets, All

Question with udl and connection string does it work?

I'm having problems with the code below I keep getting an error "Keyword
not supported 'File Name'"

I was just following app.dev cbt course and for some reason it doesn't
work for me does someone know what I doing wrong

Private Sub btnBrowse_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnBrowse.Click

With OpenFileDialog1
Dim response As String
Dim strConnect As String
.Filter = "UDL connection File(*.udl)|*.udl|All Files(*.*)|*.
*"
.FilterIndex = 1
.Title = " Select a UDL File"
If .ShowDialog() = DialogResult.OK Then
txtUDLFile.Text = .FileName

SqlConnection1.ConnectionString = String.Format("File
Name={0};", txtUDLFile.Text)

SqlConnection1.Open()
If SqlConnection1.State = ConnectionState.Open Then
Console.WriteLine("Connection opened successfully")
Else
Console.WriteLine("Connection could not be
established")
End If
SqlConnection1.Close()
SqlConnection1 = Nothing

response = Console.ReadLine()

End If
End With
End Sub

Here's the udl file contents below
[oledb]
; Everything after this line is an OLE DB initstring
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=sppDb;Data Source=(local)\vsdotnet

I'm using VS.net 2003 using vb.net
TIA
Nov 21 '05 #1
1 2632
Yes the below will not work.

When specifying a udl file (which as you already know is nothing but a text
file), AND when you are using SqlConnection, the ConnectionString should be

"Integrated Security=SSPI;Persist Security Info=False;Initial
Catalog=sppDb;Data Source=(local)\vsdotnet"

i.e, start at Provider, ignore the provider key (because you are using
SqlConnection, you shouldn't specify provider), and the rest is useful.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik


"sal" <sa*@spp.net> wrote in message
news:Xn**********************@216.77.188.18...
Greets, All

Question with udl and connection string does it work?

I'm having problems with the code below I keep getting an error "Keyword
not supported 'File Name'"

I was just following app.dev cbt course and for some reason it doesn't
work for me does someone know what I doing wrong

Private Sub btnBrowse_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnBrowse.Click

With OpenFileDialog1
Dim response As String
Dim strConnect As String
.Filter = "UDL connection File(*.udl)|*.udl|All Files(*.*)|*.
*"
.FilterIndex = 1
.Title = " Select a UDL File"
If .ShowDialog() = DialogResult.OK Then
txtUDLFile.Text = .FileName

SqlConnection1.ConnectionString = String.Format("File
Name={0};", txtUDLFile.Text)

SqlConnection1.Open()
If SqlConnection1.State = ConnectionState.Open Then
Console.WriteLine("Connection opened successfully")
Else
Console.WriteLine("Connection could not be
established")
End If
SqlConnection1.Close()
SqlConnection1 = Nothing

response = Console.ReadLine()

End If
End With
End Sub

Here's the udl file contents below
[oledb]
; Everything after this line is an OLE DB initstring
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=sppDb;Data Source=(local)\vsdotnet

I'm using VS.net 2003 using vb.net
TIA

Nov 21 '05 #2

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

Similar topics

11
4228
by: Mark Yudkin | last post by:
The documentation is unclear (at least to me) on the permissibility of accessing DB2 (8.1.5) concurrently on and from Windows 2000 / XP / 2003, with separate transactions scope, from separate...
1
1713
by: Soeren S. Joergensen | last post by:
Hi, A customer of mine (or actually the security department of this company) requires that SQL connections are handet out from COM+ server object. The connection will be used from a web...
7
1359
by: Steve Franks | last post by:
Using VS.NET 2005 RC - Am I understanding correctly from the docs that connection pooling for my ADO.NET db connections will happen automatically? Do I need to do anything to enable this feature? ...
2
6533
by: Robert Smith jr. | last post by:
Hello, Please pardon my newbie question ... I am building an ASP.NET page that displays a recordset with a Delete statement enabled (this all works fine). I want to Insert the current row...
7
2217
by: News | last post by:
Hello, I have to build a program with the future in mind and I need a bit of guidance from a guru or two. My program will start as a multi-user Windows Application built with VB.Net and using an...
7
2454
by: Lau Lei Cheong | last post by:
Hello, Actually I think I should have had asked it long before, but somehow I haven't. Here's the scenerio: Say we have a few pages in an ASP.NET project, each of them needs to connect to...
4
3591
by: Engineerik | last post by:
I am trying to create a socket server which will listen for connections from multiple clients and call subroutines in a Fortran DLL and pass the results back to the client. The asynchronous socket...
9
1478
by: Mike Hofer | last post by:
In a large application I'm working on (ASP.NET 1.1, VS2003), we have a base class that wraps stored procedures. Essentially, this base class (StoredProcedureBase) encapsulates the code to set up...
20
3244
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how...
0
7264
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
7543
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...
1
7106
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...
0
5689
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5094
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4749
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...
0
3236
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...
0
3226
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
805
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.