10-10-18, 06:12 PM
(10-10-18, 03:48 PM)asemshahen5 كتب : ادخل الى المديول "GlobalModule"و تأكد من معلومات نص الاتصال و ضع جملة :
كود :
Public Function opendb() As SqlConnection
'conn.ConnectionString = "Data Source=(LocalDB)\v11.0;AttachDbFilename=" + Application.StartupPath + "\dental.mdf"
Try
Dim conn As New SqlConnection("Data Source=(Local);Initial Catalog=dental;Integrated Security=True")
If conn.State = 1 Then conn.Close()
conn.Open()
cmd.Connection = conn
cmd.CommandType = CommandType.Text
Return conn
Catch ex As Exception
MsgBox(ex.Message)
Return Nothing
End Try
End Function
اخي وضع الاتصال صحيح لاني شغلت البرنامج وقام بالاتصال بقاعدة البينات بنجاح لكن هذا الخطأ لا اعلم سببه مع ذلك ساحاول لكن هل يمكن ان تشرح لي الكود الذي كتبته
