473,587 Members | 2,258 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.EventArg s) Handles btnBrowse.Click

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

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

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

response = Console.ReadLin e()

End If
End With
End Sub

Here's the udl file contents below
[oledb]
; Everything after this line is an OLE DB initstring
Provider=SQLOLE DB.1;Integrated Security=SSPI;P ersist Security
Info=False;Init ial Catalog=sppDb;D ata Source=(local)\ vsdotnet

I'm using VS.net 2003 using vb.net
TIA
Nov 21 '05 #1
1 2638
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 ConnectionStrin g should be

"Integrated Security=SSPI;P ersist Security Info=False;Init ial
Catalog=sppDb;D ata 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.EventArg s) Handles btnBrowse.Click

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

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

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

response = Console.ReadLin e()

End If
End With
End Sub

Here's the udl file contents below
[oledb]
; Everything after this line is an OLE DB initstring
Provider=SQLOLE DB.1;Integrated Security=SSPI;P ersist Security
Info=False;Init ial Catalog=sppDb;D ata 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
4241
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 threads of a multithreaded program using embedded SQL. Since the threads do not need to share transaction scopes, the sqleAttachToCtx family of APIs do...
1
1715
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 application. The idea is to let the COM+ object create a new SqlConnection with integrated security set, so that the user doing the actual connecting to the...
7
1362
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? Basically I have code in a method that does this: SqlConnection conn = null; try { conn = new SqlConnection("Data Source=myserver;Initial
2
6538
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 *that is going to be deleted* into another table, before the original data is deleted. I am trying to use the RowDeleting method to call an Update...
7
2225
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 Access 2002 database backend. The future will require that 1. The database be switched with minimal effort to SQL Server and 2. A Web Application...
7
2463
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 the database(Does not really matter but, in case you need to know, either MSSQL or ODBC ones) a few times when it loads to do the CURD things. How...
4
3594
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 client and asynchronous socket server example code provided in the .NET framework developers guide is a great start but I have not dealt with...
9
1484
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 the connection, transaction, command and parameters required to invoke a stored procedure on our SQL Server database. It provides helper methods that...
20
3257
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 many connection has been used ? 2. If the maximum pool size has been reached, what happens when I call the method Open to open the connection ? Will I...
0
8205
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. ...
0
8339
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...
0
8220
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...
1
5712
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
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...
0
3872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2347
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.