thirteentwenty
Well-known member
OK, I was really hoping that I could figure this one out on my own, but alas I throw in the towel and return for more assitance...
What I'm trying to do: Update a memo field, I'm using the below code:
The problem: Nothing, well nothing updates, what ever is in the textbox does not go into the memofield... but the function does not produce any errors
What I've tried, I have in another function, an INSERT, and have placed the notes in there with the expected results, the notes were inserted...
So, it would seem to me that the underlying isssue is with this update command (I' have a functioning update else where) but it seems that I cannot update this table specifically... (I've tried to update other columns as well)
Any suggestions would be much appreciated...
oh yes and I did try the DW2 link *wink*
What I'm trying to do: Update a memo field, I'm using the below code:
VB.NET:
Public Function addNotes()
' Add Notes
Dim notes As String = frm_invoices.txt_inv_notes.Text
' Invoice functions
Dim strAddNotes As String
Dim cmdAddNotes As New OleDb.OleDbCommand
Dim chkAddNotes As Integer
' strInvoiceSetup = "INSERT INTO [Transaction Header]([Tax Rate:]) VALUES (TaxRate)"
If notes <> "" Then
strAddNotes = "UPDATE [Transaction Header] SET [Notes] = notes WHERE ID=" & frm_invoices.txt_inv_transID.Text & ""
MessageBox.Show("Trans ID: " & frm_invoices.txt_inv_transID.Text & vbCrLf & "Notes: " & notes, "If statement")
Else
Return MessageBox.Show("Exiting Function", "", MessageBoxButtons.OK)
Exit Function
End If
Try
HandleConnection(con)
' Update Invoice with Notes Field
cmdAddNotes.CommandText = strAddNotes
cmdAddNotes.CommandType = CommandType.Text
cmdAddNotes.Parameters.AddWithValue("Notes", notes)
cmdAddNotes.Connection = con
chkAddNotes = cmdAddNotes.ExecuteNonQuery()
' ERROR CONTROL
' Uncomment below code to see if update is successful
If Not chkAddNotes = 0 Then
MessageBox.Show("Notes Added Successfully", "ExecuteNonQuery Error", MessageBoxButtons.OK)
Return True
Else
MessageBox.Show("Update Failed", "ExecuteNonQuery Error", MessageBoxButtons.OK)
Return False
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "Update Error Report", MessageBoxButtons.OK, MessageBoxIcon.Error)
Return ""
Exit Function
Finally
cmdAddNotes.Parameters.Clear()
End Try
Return ""
End Function
The problem: Nothing, well nothing updates, what ever is in the textbox does not go into the memofield... but the function does not produce any errors
What I've tried, I have in another function, an INSERT, and have placed the notes in there with the expected results, the notes were inserted...
So, it would seem to me that the underlying isssue is with this update command (I' have a functioning update else where) but it seems that I cannot update this table specifically... (I've tried to update other columns as well)
Any suggestions would be much appreciated...
oh yes and I did try the DW2 link *wink*
Last edited: