我正在制作一个数据库程序,用户可以在其中添加他们的数据,例如lrn,名字,中间名和姓氏。我的数据源很好,并且该表已在数据网格视图中加载,但是当我运行该程序并输入新数据时,它们不会显示在数据网格或访问文件中
这是代码:
Public Class Form1
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
Dim poi As DialogResult
poi = MessageBox.Show("Do You Want To Exit?", "Exit Program?", MessageBoxButtons.OKCancel)
If poi = DialogResult.OK Then
Application.Exit()
End If
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'BoboDataSet.Table1' table. You can move, or remove it, as needed.
Me.Table1TableAdapter.Fill(Me.BoboDataSet.Table1)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Table1BindingSource.AddNew()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
'this button users click that will transfer the user's inputted data to the data grid viewer and updates the database
Table1BindingSource.EndEdit()
Table1TableAdapter.Update(BoboDataSet.Table1)
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Table1BindingSource.RemoveCurrent()
End Sub
结束班级
我有点困惑!我认为数据源中的配置有误,但是我按照步骤输入它,并且已经将数据库属性更改为“如果较新则复制”,但是输入的新数据不会显示在数据库网格查看器和访问文件中
感谢您的回复:) *希望是为了更好地反映我的问题而进行编辑
答案 0 :(得分:0)
最后!我已经解决了这个问题。文本框未在数据绑定中绑定到表。我只是在文本框属性的“数据绑定”部分中进行了更改。不便之处,敬请谅解。