a two dimensional array question

a two dimensional array question

am 03.02.2007 02:03:00 von bettys

Hi all,
I have a strange question which I cannot figure that out myself.
I tried to escape some apostrophe in the name string.
Function PrepCustomerDatatoArray(iTotNumCustomer)
dim CustInfoArr(50, 5)
....
for i=1 to iTotNumCustomer

If InStr(FName, "'") <> 0 Then
CustInfoArr(i-1, 0)=EscStrApostrophe(FName) ' B'etty will become B''etty
Else
CustInfoArr(i-1, 0)=FName
End If
Response.Write CustInfoArr(i-1, 0) & "
" ' It displayed B''etty
If MInit<> "" Then
CustInfoArr(i-1, 1)=MInit
End If
If InStr(LName, "'") <> 0 Then
CustInfoArr(i-1, 2)=EscStrApostrophe(LName)
Else
CustInfoArr(i-1, 2)=LName
End If
Response.Write CustInfoArr(i-1, 2) & "
" ' It displayed O''neal if
customer enter O'neal as last name
CustInfoArr(i-1, 3)=BDate

Next
'but here it what strange thing happened
'the fname and lname in array with apostrophe will become empty here
'but it display MInit and BirthDate OK
'if fields don't have apostrophe, it will be displayed fine
'what is going on the array is in the scope since mInit and bDate are fine
and if
'no apostrophe, everything is fine?
For i=1 to iTotNumInsured
Response.Write CustInfoArr(i-1, 0) & " " & CustInfoArr(i-1, 1) & " " &
CustInfoArr(i-1, 2) & " " & CustInfoArr(i-1, 3)
Next
End Function
--
Betty

RE: a two dimensional array question

am 05.02.2007 09:21:02 von lukezhan

Hi Betty,

Would you please also post the code in EscStrApostrophe() here? This may
help us find the problem. Also, I suggest you may test with this: Replace
following code:

If InStr(FName, "'") <> 0 Then
CustInfoArr(i-1, 0)=EscStrApostrophe(FName) ' B'etty will become B''etty
Else
CustInfoArr(i-1, 0)=FName
End If

With

CustInfoArr(i-1, 0)=FName

This won't call EscStrApostrophe() so we can check if this is the problem.

Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/de fault.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx .
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

RE: a two dimensional array question

am 05.02.2007 20:19:00 von bettys

Hi Luke,
Here is the function:

Function EscStrApostrophe(ByVal Str)
dim NameArr
dim NameStr
NameStr=""
NameArr=Split(Str, "'", -1)
For i=0 to UBound(NameArr)
NameStr=NameStr & NameArr(i) & "''"
Next
EscStrApostrophe=Left(NameStr, Len(NameStr)-2)
End Function
--
Betty


"Luke Zhang [MSFT]" wrote:

> Hi Betty,
>
> Would you please also post the code in EscStrApostrophe() here? This may
> help us find the problem. Also, I suggest you may test with this: Replace
> following code:
>
> If InStr(FName, "'") <> 0 Then
> CustInfoArr(i-1, 0)=EscStrApostrophe(FName) ' B'etty will become B''etty
> Else
> CustInfoArr(i-1, 0)=FName
> End If
>
> With
>
> CustInfoArr(i-1, 0)=FName
>
> This won't call EscStrApostrophe() so we can check if this is the problem.
>
> Sincerely,
>
> Luke Zhang
>
> Microsoft Online Community Support
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscriptions/managednewsgroups/de fault.aspx#notif
> ications.
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscriptions/support/default.aspx .
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
>
>

RE: a two dimensional array question

am 06.02.2007 04:11:07 von lukezhan

Hi Betty,

Thank you for the code. I tested it and didn't find any issues with it.
Anyway, I suggets you may try following code instead:

CustInfoArr(i-1, 0)=EscStrApostrophe(FName) ' B'etty will become B''etty
Else
CustInfoArr(i-1, 0)=FName
End If

with

CustInfoArr(i-1, 0)=replace(FName,"'","''")

The replace method can help us replace ' with ".

And, I also suggest you may debug in these code in Visua Interdev to see if
the passed parameters are empty, since we get no output, and the code is
correct.

Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/de fault.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx .
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

RE: a two dimensional array question

am 07.02.2007 19:46:01 von bettys

Luke,
Thank you for that. It should works. I appreciated
--
Betty


"Luke Zhang [MSFT]" wrote:

> Hi Betty,
>
> Thank you for the code. I tested it and didn't find any issues with it.
> Anyway, I suggets you may try following code instead:
>
> CustInfoArr(i-1, 0)=EscStrApostrophe(FName) ' B'etty will become B''etty
> Else
> CustInfoArr(i-1, 0)=FName
> End If
>
> with
>
> CustInfoArr(i-1, 0)=replace(FName,"'","''")
>
> The replace method can help us replace ' with ".
>
> And, I also suggest you may debug in these code in Visua Interdev to see if
> the passed parameters are empty, since we get no output, and the code is
> correct.
>
> Sincerely,
>
> Luke Zhang
>
> Microsoft Online Community Support
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscriptions/managednewsgroups/de fault.aspx#notif
> ications.
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscriptions/support/default.aspx .
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
>
>