Hey.

I would like to ask for help regarding SQL server. I have developed a client-side application to run on my clients' agents machines. They will use this software to add items to a cart and print an invoice, in addition to the program eMailing my client to notify him of a sale. Now the problem is at the moment the Products my clients' agents add to their shopping cart (using my software) are stored locally in a .txt file (CSV). Meaning if my client wants to higher/lower the price of one of his products, he has to email all his agents and tell them to higher/lower the cost in the CSV file. To fix this my client would like ONE SQL database on his server to which my software would connect and download the info into a list view (or something of the like). I have very limited knowlege in SQL and would simply like to ask if anyone could possibly point me in the right direction as to how I might go about creating such an application???


Thank you

If your application is already running and working for your client, I would be weary about making major changes to the application. What I would do if I were you is when the program launches, I would have it download a new text file from a predefined path on the internet... that way, the changes can be distributed just by people opening and closing the application.

Cheers ericstenson that's defo something I will consider. But for now my client is adamant I use a secure SQL database connection, also for my benefit as I don't know much about SQL this could be a good learning curve.

Any solutions as to how I might do this using SQL? -- :)

Sure. You will need to create an SQL database and table with the product information. You will need to create a user account (most likely) within SQL to allow your program to access the database.

you will then need to connect to the database. let the wizard create the connection string for you.

when the user enters the item id, you will then need to retrieve the item price and description. you can do this through something like

dim conn1 as new data.sqlclient.sqlconnection(sqldatasource1.connectionstring)
dim SQL_SELECT_P as string = "Select ItemPrice from Items where ItemID = '" & itemid.text & "'"
dim SQL_SELECT_D as string = "Select ItemDesc from Items wher ItemID = '"& itemid.text & "'"
dim SQL_Command_P as new data.sqlclient.sqlcommand(Sql_Select_P,conn1)
dim SQL_Command_D as new data.sqlclient.sqlcommand(Sql_Select_D,conn1)
conn1.open
ItemDescription.Text = sql_Command_D.executescaler
ItemPrice.Text = sql_Command_P.executescaler
conn1.close

There are obviously better ways to do it and stuff and it will be slightly more complicated in the end, but that should get you going.

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.