S
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
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