none
Viewing update query created by a command object RRS feed

  • Question

  • I'm updating a database using the command object.
    I've suddenly started getting an error Query " is corrupt

    Strange message!

    Anyway, I'm wondering if there is any way I can actually look at the query that has been built by the command object?
    So I can determine what is corrupt.
    (I don't think I've changed this for about 5 years so I'm confused as to why I'm getting this error now.)

    Dim com As New OleDbCommand("UPDATE TBLJAWDETAILS SET [JWID] = @jwid, [SIZE] = @size, [JBID] = @jbid, [IDGP] = @idgp, [NOTES] = @notes, [TDATE] = @datenow WHERE [JAWDETAILID] = @detid;", con)
            com.CommandType = CommandType.Text
            com.Parameters.Add("@jwid", OleDbType.VarChar).Value = CboJw.Text
            com.Parameters.Add("@size", OleDbType.Double).Value = TextBox10.Text
            com.Parameters.Add("@jbid", OleDbType.VarChar).Value = CboJb.Text
            com.Parameters.Add("@idgp", OleDbType.Boolean).Value = CheckBox1.Checked
            com.Parameters.Add("@notes", OleDbType.LongVarWChar).Value = RichTextBox1.Rtf
            com.Parameters.Add("@datenow", OleDbType.Date).Value = Now.ToShortDateString
            com.Parameters.Add("@detid", OleDbType.Integer).Value = intdetailid
            Try
                com.ExecuteNonQuery()
            Catch ex As OleDbException

    Friday, November 22, 2019 4:00 PM

Answers

All replies