cpopham Posted June 9, 2004 Posted June 9, 2004 Okay, I am still working on my same project and have made quite a bit of progress. I have a combobox which the user uses to find a PO number. Based on this number I find all information on the PO number from a master Access database. I insert this information as a datarow into a dataset which has not been bound to a dataadapter as of yet. Later I will take this dataset and insert all of the information into another database. Here is how my datatable is set up with datacolumns in the dataset to accept the located information: dsAGPOs = New DataSet With dsAGPOs.Tables.Add("AGPO") .Columns.Add("ToAG", GetType(String)) .Columns.Add("PONum", GetType(String)) .Columns.Add("Vendor", GetType(String)) .Columns.Add("Buyer", GetType(String)) End With The PONum will be unique. Now if the user makes a mistake and at any point decides to remove any of the POs from the datatable, I want to allow them to do so. So my question is how can I remove any datarow in this datatable based on a PONum variable? I have this setup on mulitple tiers and I would like to create a function to accomplish this. I will pass the dataset with the POs to the function and the POnum to remove to the function and then return the dataset minus the selected POnum. Thanks, Chester Quote ____________________________________________ http://www.pophamcafe.com I am starting a developers section, more tutorials than anything.
pelikan Posted June 9, 2004 Posted June 9, 2004 DataAdapters aren't bound to DataSets. A data set has no knowledge or reference to any DataAdapter and any DataAdapter can be used to fill any DataSet. Quote IN PARVUM MULTUM
cpopham Posted June 9, 2004 Author Posted June 9, 2004 Well, boudn was the incorrect word. I just need to know how to delete a row from it based on a variable. Chester Quote ____________________________________________ http://www.pophamcafe.com I am starting a developers section, more tutorials than anything.
pelikan Posted June 9, 2004 Posted June 9, 2004 Don't understand where you have a problem. if the PONum is unique, set it as the Primary key constraint on the table. DataTable t = dsAGPOs.Tables["AGPO"]; t.PrimaryKey = new DataColumn[] { t.Columns["PONum"] }; //..... //let user delete requested PONum (wherever) DataRow r = t.Rows.Find( sPONumToDelete ); if ( r != null ) { t.Remove( r ); } //all done, row gone Quote IN PARVUM MULTUM
cpopham Posted June 9, 2004 Author Posted June 9, 2004 I was setting everything up for PONum to be the primary key and then not making it the primary key. Works fine now Thanks for the help... Chester Quote ____________________________________________ http://www.pophamcafe.com I am starting a developers section, more tutorials than anything.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.