طيب جربت كود حفظ بسيط
للتجربة فقط
Try
Dim SaveOk As Boolean
SaveOk = SQL.SQLExicute(" Insert into tblnn (mnName) values ('" & TextBox1.Text & "') ")
If SaveOk = True Then
MsgBox("تمت عملية حفظ البيانات", MsgBoxStyle.Exclamation, "تأكيد عملية الحفظ")
End If
Catch ex As Exception
MessageBox.Show("Error." & ex.Message)
End Try
والفونكشن SQLExicute موجودة بكلاس وتم استدعائها
Public Function SQLExicute(ByVal SQLStatment As String) As Boolean
Try
Dim Cmd As New SqlCommand
Cmd.CommandText = SQLStatment
Cmd.Connection = SQLCon
SQLCon.Open()
Cmd.ExecuteNonQuery()
Return True
Catch ex As Exception
Return False
MsgBox(ex.Message)
Finally
SQLCon.Close()
End Try
End Function
البيانات ما تنحفظ
وعندي مشكلة في التوافق هل لها علاقة بالموضوع ؟
للتجربة فقط
Try
Dim SaveOk As Boolean
SaveOk = SQL.SQLExicute(" Insert into tblnn (mnName) values ('" & TextBox1.Text & "') ")
If SaveOk = True Then
MsgBox("تمت عملية حفظ البيانات", MsgBoxStyle.Exclamation, "تأكيد عملية الحفظ")
End If
Catch ex As Exception
MessageBox.Show("Error." & ex.Message)
End Try
والفونكشن SQLExicute موجودة بكلاس وتم استدعائها
Public Function SQLExicute(ByVal SQLStatment As String) As Boolean
Try
Dim Cmd As New SqlCommand
Cmd.CommandText = SQLStatment
Cmd.Connection = SQLCon
SQLCon.Open()
Cmd.ExecuteNonQuery()
Return True
Catch ex As Exception
Return False
MsgBox(ex.Message)
Finally
SQLCon.Close()
End Try
End Function
البيانات ما تنحفظ
وعندي مشكلة في التوافق هل لها علاقة بالموضوع ؟
