I make windows application in Visual Studio 2010. Then i add a database. The database properties is :
Name : C:\USERS\ADMINISTRATOR\DOCUMENTS\VISUAL STUDIO 2010\PROJECTS\WINDOWSAPPLICATION4\WINDOWSAPPLICATION4\DATABASE1.MDF
ConnectionString : Data Source=.\SQLEXPRESS;AttachDbFilename="C:\Users\Administrator\documents\visual studio 2010\Projects\WindowsApplication4\WindowsApplication4\Database1.mdf";Integrated Security=True;User Instance=True
Provider : .NET Framework Data Provider for SQL Server
Type : Microsoft SQL Server
Version : 10.00.5500
I write this code :
Dim cn As New ADODB.Connection()
cn.Open("provider= SQLOLEDB.1;Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Administrator\documents\visual studio 2010\Projects\WindowsApplication4\WindowsApplication4\Database1.mdf;User Instance=True")
Dim rs As New ADODB.Recordset()
rs.Open(("Select from TB Where Surname = Stylianou "), cn)
While Not rs.EOF
MsgBox("here")
End While
And debugger says : Invalid connection string attribute