Tuesday, February 14, 2012

connection sql server problems

What is the problems of my code to connect sql database below : thx!
Code:
Dim objConn As New OleDbConnection()
objConn.ConnectionString = "Data Source=localhost;IntegratedSecurity=SSPI;user id=sa; password=sa;Initial Catalog=rental"

objConn.Open()
Error :

An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.ArgumentException: An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'.
Source Error:
Line 7: Line 8: Dim objConn As New OleDbConnection()Line 9: objConn.ConnectionString = "Data Source=localhost;IntegratedSecurity=SSPI;user id=sa; password=sa;Initial Catalog=rental"Line 10: Line 11: objConn.Open()
Your connection string is appropriate for a SqlConnection object. If you want to use an OledbConnection (which is slower), you'll have to specify Provider=sqloledb
Marcie

No comments:

Post a Comment