Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

USING TEXT BOXES TO LOAD DATA INTO DATABASE

cheezy71cheezy71 Posts: 12Member
Hi
I am new to VB.NET.
I have created a database using the dtagrid tool and XML files.
I want to add data into the feilds using text/input boxes
my to date is below

[code] Dim dtProducts As DataTable
Dim dsNorthwind As DataSet
Dim xmlfile As String = ".../Products.xml"

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dtProducts = New DataTable("Products")

dtProducts.Columns.Add("ID", GetType(Int32))
dtProducts.Columns.Add("Make", GetType(String))
dtProducts.Columns.Add("Model", GetType(String))
dtProducts.Columns.Add("#", GetType(Decimal))
dtProducts.Columns.Add("Year", GetType(Decimal))
dtProducts.Columns.Add("Driver/s", GetType(String))

With dtProducts.Columns("ID")
.AutoIncrement = True
.AutoIncrementSeed = 1
End With

dsNorthwind = New DataSet("Northwind")
dsNorthwind.Tables.Add(dtProducts)

DgProducts.DataSource = dsNorthwind
DgProducts.DataMember = "Products"

End Sub

Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btmSaveData.Click
dsNorthwind.WriteXml(xmlfile)
End Sub

Private Sub btnLoadData_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLoadData.Click
If File.Exists(xmlfile) Then
dsNorthwind.ReadXml(xmlfile)
End If

End Sub
[/code]

Also how do i display all this information, on a form simalar to the report option in acsess.

Can anyone out there help me please
Sign In or Register to comment.