Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-02-20 : 08:21:33
|
jackm writes "I am trying to read data from an Access data base, change it, and write it back. I can't get the write to work. I know I am getting the data because I have some debug lines (not shown below) that can display records that I have found.Below is the code:Dim connectionstring As String connectionstring = _"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\ace\App_Data\item.mdb;User Id=admin;Password=;" Dim myConn = New OleDbConnection(connectionstring) Dim mySQL As String = "select * from item where item.CompanyNumber = '" & CompanyNumber & "'" & _ " and item.ItemNumber = '" & ItemNumber & "'" Dim myCommand As OleDbCommand = New OleDbCommand(mySQL, myConn) Dim myAdapter As New OleDbDataAdapter Dim myDataSet As New DataSet Dim myTable As DataTable Dim myRow As DataRow Dim myCommandBuilder As OleDbCommandBuilder = New OleDbCommandBuilder(myAdapter) myRow = myTable.NewRowmyRow("CompanyNumber") = CompanyNumber myRow("ItemNumber") = TextBox1.Text myRow("Description") = TextBox2.Text myRow("LongDescription") = TextBox3.Text myRow("UnitofMeasure") = TextBox5.Text myRow("PriceClass") = TextBox6.Text myRow("ReportClass") = TextBox7.Text myRow("Vendor") = TextBox8.Text myTable.Rows.Add(myRow)myTable.AcceptChanges()myDataSet.AcceptChanges()myAdapter.UpdateCommand = myCommandmyAdapter.Update(myDataSet)I seem to be the only person who does not want to use a data grid. I am trying to build accounting applications where the user can call up records, like an item record from an inventory system, edit the fields and then write them back. I can not find any complete examples of how to do real data base work - like adding and changing customers and inventory items.Thanks, jackm" |
|
|
|
|