Results 1 to 3 of 3

Thread: Simple update query question

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2004
    Posts
    4

    Question Simple update query question

    Hi programmers!
    i have a Truedbgrid that has three columns : Productname, howmany and totalprice. (the table is ordereddatails)
    at column productname i use a dropdownlist from table products, no problem with that. at column howmany i give the number of products that i want.
    THE PROBLEM: In the third column totalprice i have the calculation of the column howmany with the price of the current product at table Products.
    QUESTION: I there any way i can do the calculation using the Truedbgrid ColumnProperties or i have to run a query using a button that updates the table orderdatails? im writing my update code which is wrong (im new, sorryyyy!!!)
    im using Jet Oledb

    Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=""C:\products\products.mdb"";Jet OLEDBatabase Password=")
    conn.Open()
    Dim ds As New DataSet
    ' select the products based on klados of order
    Dim sqlstring As String = "update orderdatails SET orderdatails.cost = orderdatails.posotita * products.timh where products.codeprod = orderdatails.codeproduct"
    dataAdapter = New OleDbDataAdapter(sqlstring, conn)
    'dataAdapter.Fill(ds, "productlist")
    dataAdapter.UpdateCommand.ExecuteNonQuery()
    conn.Close()

    i'm trying to update the table of database
    thanks!!
    Last edited by merovatis; Sep 10th, 2004 at 03:52 PM.

  2. #2
    Addicted Member
    Join Date
    Apr 2004
    Location
    Lagos, Nigeria
    Posts
    215
    What do you actually want to do? Update the database, or update the display on the grid?

    If you want to update the display on the grid, I'll suggest you create a data column in your dataset, the assign the required calculation to the expression property of the datacolumn.

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2004
    Posts
    4
    im trying to update the database...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width