|
-
Jun 3rd, 2011, 03:20 PM
#1
Thread Starter
Addicted Member
-
Jun 4th, 2011, 12:23 AM
#2
Thread Starter
Addicted Member
Re: Getting Alt + 0141 () in results
all fields in database set to nvar(255)
if relative.
-
Jun 4th, 2011, 12:13 PM
#3
Thread Starter
Addicted Member
Re: Getting Alt + 0141 () in results
I have noticed that the issue is caused by the Find function of the backend application. Upon new entry no issue, find after new insert and then there are all kinds of added spacing characters to the result from database in the single-line textbox. Although multiline textboxes do not show these characters they are still there.
Last edited by condonethis; Jun 4th, 2011 at 12:35 PM.
-
Jun 4th, 2011, 12:38 PM
#4
Thread Starter
Addicted Member
Re: Getting Alt + 0141 () in results
Solved the problem by using regex.replace(string, "[ \t\r\n]", "")
vb Code:
Public Function updatevalue(ByVal value, ByVal txtvalue) As Boolean
Dim ra As Integer
Dim thatline As String = txtvalue.text.ToString
thatline = System.Text.RegularExpressions.Regex.Replace(thatline, "[ \t\r\n]", "")
Dim command = New SqlCommand("Update PhoneNumbers Set " & value & "='" & thatline & "' WHERE LastName = '" & TxtLastName.Text _
& "' AND Firstname = '" & TxtFirstName.Text & "'", sqlphonebook.con)
If sqlphonebook.con.State = ConnectionState.Closed Then
sqlphonebook.con.Open()
End If
ra = command.ExecuteNonQuery()
sqlphonebook.con.Close()
End Function
Public Function getvalue(ByVal field1, ByVal field2, ByVal put, ByVal sqlput) As Boolean
'Creating a read of the database
Dim results As New System.Text.StringBuilder
Dim thatline1 As String
Dim command1 As New SqlCommand("SELECT rtrim(" & sqlput & ") FROM PhoneNumbers WHERE LastName = '" & field1.Text.ToString & "' AND Firstname = '" & field2.Text.ToString & "'", sqlphonebook.con)
'MsgBox(field1.ToString + Environment.NewLine + columnname + Environment.NewLine + put.ToString + Environment.NewLine + sqlput + Environment.NewLine + Environment.NewLine + command1.ToString)
' AND PerformingDate = (SELECT MAX(PerformingDate) FROM leadlog WHERE LeadTitle = '" & field.Text & "'
If sqlphonebook.con.State = ConnectionState.Closed Then
sqlphonebook.con.Open()
End If
Dim r As IAsyncResult = command1.BeginExecuteReader
Dim reader As SqlDataReader = command1.EndExecuteReader(r)
While reader.Read
For i As Integer = 0 To reader.FieldCount - 1
results.Append(reader(i).ToString & vbTab)
Next
results.Append(Environment.NewLine + Environment.NewLine)
End While
reader.Close()
command1.Connection.Close()
thatline1 = results.ToString
thatline1 = System.Text.RegularExpressions.Regex.Replace(thatline1, "[ \t\r\n]", "")
put.Text = thatline1
End Function
-
Jun 8th, 2011, 02:43 AM
#5
Thread Starter
Addicted Member
Re: Getting Alt + 0141 () in results
Obvious error is obvious now...
vb Code:
Public Function updatevalue(ByVal value, ByVal txtvalue) As Boolean
Dim ra As Integer
Dim thatline As String = txtvalue.text.ToString
thatline = System.Text.RegularExpressions.Regex.Replace(thatline, "[ \t\r\n]", "")
Dim command = New SqlCommand("Update PhoneNumbers Set " & value & "='" & thatline & "' WHERE LastName = '" & TxtLastName.Text _
& "' AND Firstname = '" & TxtFirstName.Text & "'", sqlphonebook.con)
If sqlphonebook.con.State = ConnectionState.Closed Then
sqlphonebook.con.Open()
End If
ra = command.ExecuteNonQuery()
sqlphonebook.con.Close()
End Function
Public Function getvalue(ByVal field1, ByVal field2, ByVal put, ByVal sqlput) As Boolean
'Creating a read of the database
Dim results As New System.Text.StringBuilder
Dim thatline1 As String
Dim command1 As New SqlCommand("SELECT rtrim(" & sqlput & ") FROM PhoneNumbers WHERE LastName = '" & field1.Text.ToString & "' AND Firstname = '" & field2.Text.ToString & "'", sqlphonebook.con)
'MsgBox(field1.ToString + Environment.NewLine + columnname + Environment.NewLine + put.ToString + Environment.NewLine + sqlput + Environment.NewLine + Environment.NewLine + command1.ToString)
' AND PerformingDate = (SELECT MAX(PerformingDate) FROM leadlog WHERE LeadTitle = '" & field.Text & "'
If sqlphonebook.con.State = ConnectionState.Closed Then
sqlphonebook.con.Open()
End If
Dim r As IAsyncResult = command1.BeginExecuteReader
Dim reader As SqlDataReader = command1.EndExecuteReader(r)
While reader.Read
For i As Integer = 0 To reader.FieldCount - 1
results.Append(reader(i).ToString [B]& vbTab[/B])
Next
'---------->results.Append(Environment.NewLine + Environment.NewLine)
End While
reader.Close()
command1.Connection.Close()
thatline1 = results.ToString
thatline1 = System.Text.RegularExpressions.Regex.Replace(thatline1, "[ \t\r\n]", "")
put.Text = thatline1
End Function
[/QUOTE]
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|