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