Hello,
I'm three weeks into visual basic 2005 . I use the ms access 2003 database as a backend.
I have created a form to accept data from the user. My form also has a data grid which reads data from a table and displays it. I have done this using the dataset , and binding source. My form has a binding navigator also.
A table adapter was also generated in the process.
I want to enter data through the text boxes in the form and click on the + icon on the binding navigator toolbar . I did achieve the task to this point, and the record entered is displayed on the data grid.
but I donot see the record in my database.
Question,
How do I use the table adapter to achieve this?
One of my data entry items is a date field which gives me problems. The date is stored in the mm/dd/yyyy format in the database?
Can I get a quick reply ,please??
My code is as follows
I'm three weeks into visual basic 2005 . I use the ms access 2003 database as a backend.
I have created a form to accept data from the user. My form also has a data grid which reads data from a table and displays it. I have done this using the dataset , and binding source. My form has a binding navigator also.
A table adapter was also generated in the process.
I want to enter data through the text boxes in the form and click on the + icon on the binding navigator toolbar . I did achieve the task to this point, and the record entered is displayed on the data grid.
but I donot see the record in my database.
Question,
How do I use the table adapter to achieve this?
One of my data entry items is a date field which gives me problems. The date is stored in the mm/dd/yyyy format in the database?
Can I get a quick reply ,please??
My code is as follows
VB.NET:
Public Class frmdowntime
' ( form downtime is the name of my form)
Private Sub frmdowntime_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Pmsys2007DataSet.Downtime' table.
'You can move, or remove it, as needed.
Me.DowntimeTableAdapter.Fill(Me.Pmsys2007DataSet.Downtime)
End Sub
Private Sub BindingNavigatorAddNewItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles BindingNavigatorAddNewItem.Click
Dim DataRow = Pmsys2007DataSet.Downtime.NewRow
DataRow.Item("RigId") = Me.TextBox1.Text
DataRow.Item("equp") = Me.TextBox2.Text
DataRow.Item("dof") = XmlConvert.ToDateTime(Me.TextBox3.Text, "mm-dd-yyyy")
DataRow.Item("Rof") = Me.TextBox4.Text
DataRow.Item("tof") = Me.ListBox1.Text
Dim tUID As UInteger
Try
DowntimeTableAdapter.Insert(tuid, "RigId", "equp","dof","tof", "Rof")
Catch ex As Exception
MessageBox.Show("Insert Failed")
End Try
RefreshDataset()
End Sub
Private Sub RefreshDataset()
Me.DowntimeTableAdapter.Fill(Me.Pmsys2007DataSet.Downtime)
End Sub
Last edited by a moderator: