Hi, I have a few problems with my program. It's almost complete however a few things need to be changed before I burn it to CD.
The program (VB.NET 2005) basically involves connecting to a local access db and using queries and sql statements to load/save/edit data.
On the last part I have to save to the DB then edit that same record.
Only 2 rows need to be edited, quantity and total cost.
This is what I used to save, it works fine.
Now I need to edit the record after saving it.
I cannot use the same save query as it will create a new order id. I want to edit the 2 rows and leave everything else alone.
I tried using "update tblOrders SET TotalCost= lblcost.txt" however it didnt work.
Another thing I need to do is make sure that when the program is loaded from the CD it finds the database correctly.
At the moment I have the location as:
How would I go about changing it so that it automatically finds the location of the db on any computer. Ie on some computers the cd drive will be different then D or F I need to make sure that it will load the db on all computers.
The program (VB.NET 2005) basically involves connecting to a local access db and using queries and sql statements to load/save/edit data.
On the last part I have to save to the DB then edit that same record.
Only 2 rows need to be edited, quantity and total cost.
This is what I used to save, it works fine.
Code:
conn = New OleDbConnection(strConn)
Dim com As New OleDbCommand("Insert into tblOrders (CustomerID, ProductID, ProductPrice, OrderQuantity, TotalCost) values(" & cboname.Text & ", " & _productID & ", " & _ProductPrice & ", " & quantityupdown.Value & ", " & lblcost.Text & ")", conn)
conn.Open()
Try
com.ExecuteNonQuery()
MessageBox.Show("Saved")
Catch e1 As OleDb.OleDbException
MessageBox.Show(e1.Message)
Finally
conn.Close()
End Try
Now I need to edit the record after saving it.
I cannot use the same save query as it will create a new order id. I want to edit the 2 rows and leave everything else alone.
I tried using "update tblOrders SET TotalCost= lblcost.txt" however it didnt work.
Another thing I need to do is make sure that when the program is loaded from the CD it finds the database correctly.
At the moment I have the location as:
Code:
Private strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\UNI\Dataprogramming\Assignment\ASS1\WindowsApplication1\WindowsApplication1\Gadgets.mdb"
Public Property productID() As Integer
How would I go about changing it so that it automatically finds the location of the db on any computer. Ie on some computers the cd drive will be different then D or F I need to make sure that it will load the db on all computers.