OleDbDataAdapter oAd = new OleDbDataAdapter(this.sSelectString ,oCon);when you should have had:
this.oAd = new OleDbDataAdapter(this.sSelectString ,oCon);~~Bonnie
>-------------------------------------------------- >using System; >using System.Data; >using System.Data.SqlClient; >using System.Data.OleDb; > >public class BusObj >{ > protected OleDbConnection oCon ; > protected string sSelectString ; > protected string sTableName = ""; > protected string sFields = "*"; > protected System.Collections.ArrayList cReqFields = new System.Collections.ArrayList(0); > protected OleDbDataAdapter oAd; > > public BusObj() > { > } > > public virtual DataSet GetData() > { > DataSet oDS = new DataSet(); > this.oCon = new OleDbConnection(@"Provider=vfpoledb.1;Data Source=C:\ISRC\DFISR.dbc"); > this.oCon.Open(); > // Error handling missing!!! > this.sSelectString = "SELECT " + this.sFields + " FROM " + this.sTableName; > OleDbDataAdapter oAd = new OleDbDataAdapter(this.sSelectString ,oCon); > oAd.Fill(oDS,this.sTableName); > this.oCon.Close(); > return oDS; > } > > public virtual int Save(DataSet oDS) > { > //create a CommandBuilder and build the delete,update and insert commands > OleDbCommandBuilder CommandBuilder = new OleDbCommandBuilder(oAd); > oAd.SelectCommand = new OleDbCommand(this.sSelectString,this.oCon); > oAd.DeleteCommand = CommandBuilder.GetDeleteCommand(); > oAd.UpdateCommand = CommandBuilder.GetUpdateCommand(); > oAd.InsertCommand = CommandBuilder.GetInsertCommand(); > > //Update the data in the dataset > int RowsUpdated = oAd.Update(oDS); > return RowsUpdated; > } >} >--------------------------------------------------->