I am using a Windows form application with ADO.net entity model 3.5..
I get the Error message, "The underlying provider failed on Open" with the underlying message "An attempt to attach an auto-named database for file C:\Users\Khurram\documents\visual studio 2010\Projects\EmpManager\EmpManager\bin\Debug\main.mdf failed. A
database with the same name exists, or specified file cannot be opened, or it is located on UNC share."
I'm just getting started with ADO.net, so this may be a very Noob'y question. This is the part of the code that the error is at.
Using MyData As New XCo
Dim Emps = From x In MyData.Employees Select x
Dim AvailableEmps As New List(Of Employee)
For Each Emp As Employee In Emps 'Error Here
If Emp.Name.Contains(TextBox_SEARCH_EmployeeName.Text) = True Then
AvailableEmps.Add(Emp)
End If
Next
If AvailableEmps.Count = 1 Then
LoadEmployee(AvailableEmps(0).ID)
ElseIf AvailableEmps.Count > 1 Then
Dim ssd As New SearchSelectDialog
ssd.FoundEmployees = AvailableEmps
ssd.ShowDialog()
ElseIf AvailableEmps.Count < 1 Then
MessageBox.Show("No match found", "information", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Using
Else
Hope someone could help me, Thanks..