Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

____________________________________________

http://www.pophamcafe.com

I am starting a developers section, more tutorials than anything.

Posted
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.
IN PARVUM MULTUM
Posted

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

IN PARVUM MULTUM
Posted

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

____________________________________________

http://www.pophamcafe.com

I am starting a developers section, more tutorials than anything.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...