هذا هو كود الاتصال
Public Function getConnection() As OleDbConnection
Dim conn As New OleDbConnection
Dim conn_string As String
conn_string = ("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\pc\Desktop\New Folder\tadSQL.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True")
conn.ConnectionString = conn_string
conn.Open()
Return conn
End Functionكنت اعمل في البداية على قاعدة بيانات اكسس وكان يعمل مضبوط لكن لما حولت القاعدة إلى Sql2005 حدثت المشكلة
طبعاً المشكلة التي ظهرت
Server Error in '/Tad-4' Application.
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 19: 'conn_string = ("Provider=SQLOLEDB.1; Server=\\moath\SQLEXPRESS;Database=tadSQL.mdf")Line 20: Line 21: conn.ConnectionString = conn_stringLine 22: '= ("Data Source=.\SQLExpress;Integrated Security=true;User Instance=True;AttachDBFilename=|DataDirectory|tadSQL.mdf")Line 23: ' conn_string
Source File: D:\Tad-4\App_Code\common.vb Line: 21