Hello,
what's wrong with this code ,
Nothing added to database
what's wrong with this code ,
Nothing added to database
VB.NET:
[left]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim TRS As DataRow = DataSet11.Bayynat_db.NewRow
Try
TRS("Revenue") = TextBox1.Text
TRS("Expenses") = TextBox2.Text
TRS("Note") = TextBox3.Text
TRS("Date") = DateTimePicker1.Value.Date
DataSet11.Tables("Bayynat_db").Rows.Add(TRS)
OleDbDataAdapter1.Update(DataSet11)
MsgBox("Data Was SuccessFully Added To The DataBase", MsgBoxStyle.Information, Me.Text)
TextBox1.Focus()
Catch
MsgBox("2 Records were added with the same primary key. Changes canceled.", MsgBoxStyle.Critical, Me.Text)
TRS.Delete()
DataSet11.Clear()
End Try
MsgBox("Data Was SuccessFully Added To The DataBase")
OleDbConnection1.Close()
Me.Close()
End Sub[/left]