Manipulate Table Data...?
Hi
Im learning C# lately. Im working right now on a project that should help me learn some new stuff about C# programming...
I'm programming a simple accounting software, that can be used by small businesses, especially by small shops. This software should register products, it will have a form to sell them and pay bills, a form to use for furnishing, and will also make reports and such stuff...
I made the register form, but now I'm having some problems with furnishing form.
For example, when the store owner buy some products (furnish his store with products) I want to register them on furnishing form, but he will be able to register these products only if they're registered first in the Registering Form... In the furnishing form he will only need to enter the product Barcode and the Quantity, and these automatically will be added to the database (furnishing table) and the other details for the product will be taken from the other table (registering table)...
I usually use LINQ's to take a row from a table, for example, a row where given barcode match, but i dont know how to take a specific cell from that row, and send (or add) the data to another cell on another table...
Hope u can understand what im asking ... Im sorry for my bad English...
Hope ill find some help too..
thnx a lot...
naura paxPosted Aug 1, 2009, 5:56 AM
You'll realy have to give your table structures.
And I hope you have kept some reference of product (or order) in your Furnishing table. If you that you would know exactly which row to update.
Quote: If you know which row exactly you want to update, that can be accesed by your primary key.. combination of columns that give a unique row. And you know which columns to update (say qty) you can easily get a cell- Cell = [RowIndex][ColumnIndex].
Don't make your application unnecessarily complex just think of simple terms.
Thanks and Regards
Flamur HadjaPosted Jul 26, 2009, 8:52 AM
Exatcly, ur method didnt work couse what i need Is something else..
Since it seems that u didnt understand my question I will try to clarify it..
I want to have a table where the user can register products and stuff like that... I've already created this table and made a form for that...
Now, I will create 2 more forms, a form from where the user can sell the products, and a form from where the user can keep track about the number of products he bought for his store and the date... Now I want to use the tblRegister table as a base from where the info about products will be taken...
For example... When the user buy some stocks, he will need to keep track about that, so he can make reports about how much products did he buy in a month or something...
so, for this he will use the form for Furnishing, and in that form i want to be a Text Box where the user can enter the product barcode and another Text Box where the user will enter the Quantity, so when he click Add i want to search in tblRegiser find the product using the entered barcode and take the info for that product from that row, and add them to the Furnishing table... for example... the name from a cell in tblRegister will be taken from there and will be inserted to the Furnishing table, the price will be taken from there and will be registered to the Furnishing table... etc... And the quantity will be taken from the text box, and the date will be added automatically in a cell to the Furnishing table...
The problem is how to take a specificcell from the tblRegister and add it to a specific cell in the Furnishing Table, and how to take the quantity from the text box and add it to a specific cell in Furnishing table and to add all this info as a new row in Furnishing table...
What should I use for this ... How to do it... should I write a query or Stored Procedure in SQL, or can I do this using C# codes that manipulate with datas like Data Binding, ADO.net, LINQ, or something,,,,
It will be really good if some1 just tell me what I should use to build my App, to give me some ideas couse im really confuse...
IF my question isnt still clear please let me know, I will then send the tables and some other pics couse I reeally need to solve this...
thnx a lot...
Flamur HadjaPosted Jul 15, 2009, 1:28 PM
however... ill give it a try after my holydays...
thnx a lot for ur reply.. couse I couldnt have answer from any forum till now...
thnx again...
naura paxPosted Jul 15, 2009, 12:54 AM
sorry just couldn't download your image coz firewall won't let me.
I assume you have two datatables furnishing and other. and you want to copy value of cell from one to another.
I am thinking at very simple terms so please correct me-
DataTable2.BeginEdit();
DataTable2.Row[YourRowNumber]["YourColumnName"]=
DataTable1.Row[YourRowNumber]["YourColumnName"];
DataTable2.EndEdit();
This is how you can set the cells of the datatables you are using as datasource directly.
Please tell me if I have understood it right and that's what you need.
Flamur HadjaPosted Jul 14, 2009, 1:21 PM
Flamur HadjaPosted Jul 13, 2009, 7:07 PM