|
| UltraDangerLord (13) | |||||
| Hello All, So Recently I undertook a project to retrieve data (in the form of products and product prices) from excel and upload the data appropriately to my companies website. (for more info)Reference: http://www.cplusplus.com/forum/windows/2133/ So what I realized was, that interacting with database, was the most straightforward way to update my products. So i created this app to connect to a Mysql database then read and write a price value into the database. This program was written in C#, not C++, (I found source code to start with in C#) So for now I only have one problem... the app is not executing a part of my code correctly. It does update the database correctly, It just does'nt display the change in the log This is the problem area:
Later I would like to incorporate Excel files converted into CSV files store them in a array i think and just have the whole process automated. Right now the app is setup for manual. But as I'm learning, I want to try and automate it more and more. (any suggestions would be appreciated.) Here is the full source code:
If you would like a copy of the program itself, just post a comment and I can provide a link to the exe or the project files. Oh and Thanks for the help! Peace Peace | |||||
Last edited on | |||||
| Zaita (2112) | |
| My understanding is that an update statement will not return the records you have edited. You will need to execute a 'select' statement afterwards. | |
| UltraDangerLord (13) | |||
| Thanks For replying Zaita, Your always helping me out =) I kinda figured that was happening... I had tried this code below and nothing happened...same problem as above.
Should I place this line somewhere else ? OdbcCom = new System.Data.Odbc.OdbcCommand("select `products_price` from `products` where `products_model`='" + txtProduct.Text + "'", OdbcCon);Either way I guess its not a super big deal it still writes to the database properly. But it would be nice =) | |||
| Zaita (2112) | |
| You are over-writing OdbcCom. You should, create the com (update), execute it, create a new one (select), execute it. Since this is in C# you shouldn't have to worry about freeing up the memory :) Edit: You could also have a stored procedure on the database server. This is the best practice approach. | |
Last edited on | |
| UltraDangerLord (13) | |||
Actually I'm having a new problem... The log is'nt working correctly now.
these 2 buttons above are not working properly, these lines below do not print to the log. just for these 2 buttons txtLog.AppendText(">> " + OdbcDR[0] + "\r\n");But they do go threw the while statement... I tested it. Also i notice that the .sln file is not saving when i choose save all from the file menu. The really wierd thing is that this worked yesterday..... and when i restarted my comp.... it did'nt Any ideas ? | |||
Last edited on | |||
| Zaita (2112) | |
| Restart your computer :P | |
| UltraDangerLord (13) | |
| That was the problem..... sorry for the lag on the reply | |
This topic is archived - New replies not allowed.
