10-10-18, 03:48 PM (آخر تعديل لهذه المشاركة : 10-10-18, 04:05 PM {2} بواسطة 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
سبحان الله وبحمده سبحان الله العظيم و الحمد لله ولا اله الا الله والله اكبر
(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
اخي وضع الاتصال صحيح لاني شغلت البرنامج وقام بالاتصال بقاعدة البينات بنجاح لكن هذا الخطأ لا اعلم سببه مع ذلك ساحاول لكن هل يمكن ان تشرح لي الكود الذي كتبته