Ed

Ed

  • NA
  • 1
  • 5.3k

No mapping exist from object type

Jan 25 2010 9:33 PM

Hello


I am getting this erro that I never had before, any help is appreciated

No mapping exists from object type System.Data.SqlClient.SqlConnection to a known managed provider native type.


My code:
Dim
cmd As SqlClient.SqlCommand
Dim cmdString As String = ("SELECT [Position] FROM [login] WHERE (([User] = ?) AND ([Password] = ?))")
Dim conn As New SqlClient.SqlConnection("Data Source=ED_SDESKTOP\SQLEXPRESS;Initial Catalog=Website;Integrated Security=SSPI")
cmd =
New SqlClient.SqlCommand(cmdString, conn)
cmd.Parameters.Add(
"SELECT [Position] FROM [login] WHERE (([User] = ?) AND ([Password] = ?))", conn)
conn.Open()
Dim myReader As SqlClient.SqlDataReader
myReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
If myReader.Read() Then
FormsAuthentication.RedirectFromLoginPage(txtUsername.Text,
False)
Else
Response.Write(
"Invalid credentials")
End If
myReader.Close()