A couple of observations. Your are using an SQL Server data provider
(SQLOLEDB) and a generic OleDbConnection. The SQLConnection class is
designed specifically for SQL Server and will generally provide better
performance. Second, generally, the Data Source property of the connection
string refers to the SQL Server instance rather than the .mdf file.
--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com
This response is supplied "as is" without any representations or warranties.
"Ef Dublio" <Ef******@discussions.microsoft.com> wrote in message
news:8A**********************************@microsof t.com...
I am writing the following code, but it say invalid connection
Dim str As String
Dim query As String
Dim cmd As OleDbCommand
Dim cn As OleDbConnection
Dim dr As OleDbDataReader
str = "Provider=SQLOLEDB.1;Persist Security Info=False;User
ID=ef;Password=ef;Initial Catalog=jazz;Data Source=D:\Program
Files\Microsoft
SQL Server\MSSQL\Data\jazz_data.mdf"
query = "Select * from Login where login = '" & txt_uid.Text & "'
and password = '" & txt_pswd.Text & "';"
cn = New OleDbConnection(str)
cmd = New OleDbCommand(query, cn)
cn.Open()