Update Query

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lea

    #1

    Update Query


    i got this error msg while i trying to run the UPDATE query.there is n
    underlying..

    ERROR MSG :An unhandled exception of typ
    'System.Data.Ol eDb.OleDbExcept ion' occurred in system.data.dll

    ----------------------------------------------------------------------------------------------------------------------------------------------------

    CODE
    Dim strSQL As String
    strSQL = "UPDATE Item Master SET " & _
    "Barcode = '" & txtBarcode.Text & "', Description= '"
    txtItemDescript ion.Text & "', StandardCost= '" & txtStandardCost .Text
    "', " & _
    "RetailPric e= '" & txtRetailPrice. Text & "'
    MinSellingPrice ='" & txtMinSellingPr ice.Text & "', StockQty ='"
    txtStockQty.Tex t & "', " & _
    "StockReorderLe vel='" & txtStockReorder .Text & "' WHER
    ItemCode = '" & txtItemCode.Tex t & "'"

    Dim db As New OleDbCommand(st rSQL, dc)
    dc.Open()
    db.ExecuteNonQu ery()
    MessageBox.Show ("Record has been update successfully!", "Ite
    Master", MessageBoxButto ns.OK, MessageBoxIcon. Information

    --
    le
    -----------------------------------------------------------------------
    lea's Profile: http://www.msusenet.com/member.php?userid=156
    View this thread: http://www.msusenet.com/t-187051013

  • John

    #2
    Re: Update Query

    "lea" <lea.1q2d53@n o-mx.msusenet.com > wrote in message
    news:lea.1q2d53 @no-mx.msusenet.com ...[color=blue]
    >
    > i got this error msg while i trying to run the UPDATE query.there is no
    > underlying..
    >
    > ERROR MSG :An unhandled exception of type
    > 'System.Data.Ol eDb.OleDbExcept ion' occurred in system.data.dll
    >[/color]

    Hi Lea,

    I really can't tell what is wrong with your code. But I can tell you the
    steps I would take to try to fix it:
    -catch the exception that is being thrown that you are ignoring and see what
    the message is
    -when you are stepping through the debugger, get the generated SQL, and
    attempt to run it in the databases native sql tool (Query Analyzer if using
    SQLServer)

    My guess is that you are generating an invalid sql statement, but check your
    exception message before doing anything.

    Good luck,
    John MacIntyre

    Specializing in; Database, Web-Applications, and Windows Software


    Comment

    • lea

      #3
      Re: Update Query


      i did write the error message in my 1st post, but i think u didnt notic
      it. The Error MEssage is:"An unhandled exception of typ
      'System.Data.Ol eDb.OleDbExcept ion' occurred in system.data.dll
      ". not much information about what is wrong with my coding. but INSER
      INTO query has no problem.what's wrong :confused

      --
      le
      -----------------------------------------------------------------------
      lea's Profile: http://www.msusenet.com/member.php?userid=156
      View this thread: http://www.msusenet.com/t-187051013

      Comment

      Working...