Hi i am having problems designing a solution for this problem :
I have a form where you can choose the items you wish and type the quantity and then add them to a listview item. The itema are already saved in a database ( i am using sqlite ) but then i have to save this 'order' back into my database so i can retrieve it later for printing or just viewing what was on the 'order'. The problem is i can't figure a way to do so... I already created tables that include my items and their ids as primary keys and a table named orders where i have a primary key for the order number but i can't think of a way to combine my materials with my orders to do what i described earlier...
Please help me i am new in designing this kind of things....

Recommended Answers

All 3 Replies

Okay let's see if I understand your question right. You want to update values in your existing database correct? If so I can help you a little here (I am in the long delayed processes (thank you school) of learning how to use SQLite).

Okay so I was going to post some code I had written (that I haven't tested yet), but I was confusing myself. So instead let's start in this direction.

Remember that SQLite is just a local database, that still works the same as SQL when it comes to commands (or should I say statements). So you should look into the UPDATE statement. This link I feel will explain it better then I can at the moment.

http://www.w3schools.com/sql/sql_update.asp

If your still confused you could look at it like I did. We find the index of an entry by searching for a value in a specific field, and then updating what ever value we desire at that entry based off using the field. (hopefully this makes sense, I was struggling to find the right words)

I also assume you know how to interact with the SQLite file? If not let me know I have some code that I have written that does work

thanks for the link very useful but i have another problem... that's how i will arrange my tables in order to be able to create an order and then retrieve it later showing all the elements of the order such as quantity , item id , date and so on... it is supposed to be a group project and the guy responsible for the datanase argues that i only need the item id and item name in the order table and i can't get him to understand that we also need a table named ordered item... maybe i am wrong...any ideas on that?

Well you can tell him he's wrong based on my experience. I have successfully built a program that reads in from an SQLite database, and I did indeed need the tablename.

Oh and for the record that program used mutliple tables. It was one file (that SQLite reads from) and it had multiple tables ... therefore if I didn't have the table name I would be reading from who knows what. I mean it's not that hard to add the tablename anyway, would you like me to post some code?

(Also I have a program I use that allows me to actually view the database (like outside of my program), I forgot it's name I'll post it when I get back to campus it might help your argument).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.