Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello all,

I just finished this VB.net program I was working on and started testing it when I noticed a huge hole in it that some how I missed from the beginning.

 

I have a datagrid that is filled based on a access DB. The columns that are in the datagrid include: lineseqno, itemnumber, quantity, unit price, and discount %. I also have a column that is created at run time called Total that is quantity * unit price.

 

Now to my question: How can I either get the total column to update to the database even though it is not part of the data adapter. (I created the DA and DS at design time) If that will not work, how can I get the unit price to change based on if a radio box is selected (if a discount was taken, make unit price = unit price*(1-Discount%) ). I am not sure how to do this either way..and both I think will fit my purpose. Any suggestions?

Thanks.

Posted

I donot whether this would help or not.

Iam not sure what you want, this what I understood from your question.

 

This will get the discount value.

dim price_chng as Int16 = radiobutton1.selectedItem.value

 

As you have the datatable and it has the unitprice, uisng the rows and columns in the datatable get the respective unitprice value and store in a variable and apply the didcount one.

 

 

dim pirce_dis as int16

price_dis= price_chng * unitprice

 

the unitprice is the one which is selected based on the item, if your program is that or get the unitprice of the item which you want to apply the discount,, by using the datatable of the dataset

 

 

dim oledb_comm as new OleDb.OleDbCommand

oledb_comm.commandtext="Insert into table (unitprice) values("&price_dis&")

 

By this you can change the unitprice of the selected discount.

Rufus

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...