June 20, 2008 at 7:19 am
I have a query that replaces the contents of a text field. The new contents includes carrage return and linefeed characters. When I look at the field after the update, it appears the carriage return and linefeeds are being replaced by blanks. Anyone have an idea as to why this might be happening? The update is being done using a command object in .Net. Here's the code:
Dim rdr As SqlDataReader
Dim alertNotes As String
cmd.CommandText = "Select Notes From PatientTable " & _
"Where PatientId = " & _
"(Select PatientID From PatientVisitTable " & _
"Where TicketNumber = '" & ticketNumber & "')"
rdr = cmd.ExecuteReader()
If rdr.HasRows Then
rdr.Read()
alertNotes = rdr.Item("Notes")
rdr.Close()
alertNotes = "Test Account " & Me.mtbPhone.Text & ControlChars.CrLf & alertNotes
cmd.CommandText = "Update PatientTable " & _
"Set Notes = '" & alertNotes & "' " & _
"Where PatientId = " & _
"(Select PatientID From PatientVisitTable " & _
"Where TicketNumber = '" & ticketNumber & "')"
rowsAffected = cmd.ExecuteNonQuery()
If rowsAffected > 0 Then
profileCnt += 1
Else
nomatchProfileCnt += 1
End If
Else
rdr.Close()
End If
Thanks!!
June 20, 2008 at 7:24 am
If you're looking at it in the grid mode, then it will look as if the CrLf's are blanks... try looking at it in the text mode.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply