1. sachidhanantham ramalingam
  2. PowerBuilder
  3. Tuesday, 22 June 2021 14:06 PM UTC

Hi,

 I am using Power Builder 2017 R3 Build 1880,

I have added a Edit column on FreeForm datawindow and entered multiple lines using EnterKey for next line,

Same data has been stored in SQL table - Varchar column, when i retrieve the same data and click on that field then it has been displayed as shown below, as expected

If same Varchar column populated via another application (vb.net) i.e., entered multiple lines using EnterKey for next line, then retrieve from PB-datawindow and without click on that field then data has been displayed as expected below,

where as, as soon as click on Note column then data has been displayed in a single line as below, this is problem for us,

Note: This problem has not been identified when data saved and retrieved from PB-datawindow itself, problem occurred ONLY when data saved in vb.net and retrieved in PB-datawindow.

Also, i have checked the data format which has saved in SQL is same from both PB-datawindow and vb.net applicaiton,

Kindly revert for your suggestion,

--Sachi...

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 22 June 2021 15:00 PM UTC
  2. PowerBuilder
  3. # 1

Hi Sachidhanantham;

   Can you tell us ...

  1. What DBMS, version & build your App is using?
  2. What DB Client type are you using to connect to the DBMS?
  3. DB Client version & build?
  4. SQLCA connection settings that your App is using?
  5. Does this issue happen when run from the IDE Vs EXE or both?

Regards ... Chris

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 23 June 2021 09:47 AM UTC
  2. PowerBuilder
  3. # 2

Hi Sachi,

Quote:

"Also, i have checked the data format which has saved in SQL is same from both PB-datawindow and vb.net applicaiton,"

In my opinion there HAS to be some kind of difference in the recorded value when you use VB .net or PB. Maybe the difference is not visible though when you look at the values in the database.

My advice is to record one value using PB and another with VB .net (use the same value for both) and then select the values in whichever tool you use to do selects. Copy and paste both values in Notepad++ and use the menu  "View > Show Symbol > Show all characters". Most probably there's some kind of hex value in there that doesn't show if you don't. You could also paste the values in a hexadecimal editor and then have a look at what's in there.

My wild guess is that in one of the values the "Enter" will probably be a "Ctrl+Enter" or "Shift+Enter".

HIH,

regards

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 23 June 2021 09:57 AM UTC
  2. PowerBuilder
  3. # 3

See this page https://stackoverflow.com/questions/515722/new-line-character-in-vb-net

where it explains there's different possibilities in VB .Net for Return characters:

Reply #38:

Environment.NewLine is the most ".NET" way of getting the character, it will also emit a carriage return and line feed on Windows and just a carriage return in Unix if this is a concern for you.

However, you can also use the VB6 style vbCrLf or vbCr, giving a carriage return and line feed or just a carriage return respectively.

  • vbCrLf = "\r\n" // same as in powerbuilder 
  • vbCr = "\r" // different than powerbuilder 
  • vbLf = "\n" // different than powerbuilder 
Comment
  1. Miguel Leeuwe
  2. Wednesday, 23 June 2021 09:58 AM UTC
Just copy the string after clicking on the control where you all characters on the same line. Past it in notepad.

Most probably the "\r" is missing or the "\n" is missing.
  1. Helpful
  1. Miguel Leeuwe
  2. Wednesday, 23 June 2021 09:59 AM UTC
correction: not 'notepad' but 'notepad++'
  1. Helpful
There are no comments made yet.
sachidhanantham ramalingam Accepted Answer Pending Moderation
  1. Wednesday, 23 June 2021 10:57 AM UTC
  2. PowerBuilder
  3. # 4

Hi Miguel Leeuwe,

Many thanks for the response,

I have taken the screen shots using Notepad ++ and Hex Editor as you asked,



 

 

 

 

 

Please refer the SQL Data stored in column for both application,

 

Thanks,

--Sachi...

 

 

Comment
  1. Miguel Leeuwe
  2. Wednesday, 23 June 2021 12:56 PM UTC
Wow! That's really weird then. If the hexadecimal characters count correctly up to 71 and are exactly the same ... How can the "Select" report a different line lenght? Sorry if I'm stubborn, but I'd still maintain that the line endings are different in VB.

In powerbuilder a return is counted as 2 characters long. In VB probably only one.



What if you do "something similar to this":

select top 2, count(1), max(reqn_note) from reqn

where reqn_note like '%' + chr(13) + chr(10) + '%'

having count(1) > 0;

So trying to find the rows with at least one CRLF in it. (There's probably better ways of doing that).

I'm not sure which database you are using (seems like SQL Server?)
  1. Helpful
  1. sachidhanantham ramalingam
  2. Thursday, 24 June 2021 06:36 AM UTC
Hi Miguel Leeuwe,

Thanks again for your inputs,

Char(10) [Line Feed] character has been saved in SQL column for new line when data comes from VB.NET, where as Char(13) [Carriage Return] + Char(10) [Line Feed] characters have been saved in SQL column for new line when comes from PB.

So, I have used logic to identify the Char(10) [Line Feed] character then replaced as Char(13) [Carriage Return] + Char(10) [Line Feed] characters when saving the data in SQL column for VB.NET, which resolved this problem.



Thanks,

--Sachi...
  1. Helpful
There are no comments made yet.
sachidhanantham ramalingam Accepted Answer Pending Moderation
  1. Wednesday, 23 June 2021 05:52 AM UTC
  2. PowerBuilder
  3. # 5
0
Votes

    Hi Chris Pollach,

Many thanks for looking this issue, below i have provided details for your questions,

1. What DBMS, version & build your App is using?

Answer : SQL Server 2008 R2 (It will vary based on client), so need to support all latest version of SQL like 2010,2012, etc.,

2.What DB Client type are you using to connect to the DBMS? ,

4. SQLCA connection settings that your App is using?

Answer : SNC SQL Native Client(OLE DB)

3. DB Client version & build?

Answer : SQL Server Native Client 10 (It will vary like v11, v2012, etc.,)

5. Does this issue happen when run from the IDE Vs EXE or both?

Answer : Yes, issue comes in both IDE and EXE.

Please let me know, if you need any further input.

Thanks,

--Sachi...

Comment
  1. Chris Pollach @Appeon
  2. Wednesday, 23 June 2021 18:50 PM UTC
Hi Sachi;

Thank you for your various DBMS information! Since you are using SS2008 and DB Client v10, have you tried adding:

DBParm = "Provider='SQLNCLI10'

Regards ... Chris
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.