Chevy Mark Sunderland

Chevy Mark Sunderland

  • NA
  • 188
  • 163.6k

Cannot implicitly convert type 'System.Data.Odbc.OdbcConnection' to 'System.Data.SqlClient.SqlConnection'

Mar 9 2012 5:59 AM
Hi there, I hope your help.

I try this statement in asp net, but receive this alert, can you help me?
thanks in advance.

Server Error in '/' Application.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0029: Cannot implicitly convert type 'System.Data.Odbc.OdbcConnection' to 'System.Data.SqlClient.SqlConnection'

Source Error:

Line 42: conn.Open(); Line 43: cmd.CommandText = sSQL; Line 44: cmd.Connection = conn; Line 45: SqlDataReader dr; Line 46: dr = cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection);


Attachment: codes.zip

Answers (2)