Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > a two dimensional array question

Reply
Thread Tools

a two dimensional array question

 
 
c676228
Guest
Posts: n/a
 
      02-03-2007
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) & "<br>" ' 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) & "<br>" ' 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
 
Reply With Quote
 
 
 
 
Luke Zhang [MSFT]
Guest
Posts: n/a
 
      02-05-2007
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/subscripti...ult.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/subscripti...t/default.aspx.
==================================================

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



 
Reply With Quote
 
 
 
 
c676228
Guest
Posts: n/a
 
      02-05-2007
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/subscripti...ult.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/subscripti...t/default.aspx.
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
>
>

 
Reply With Quote
 
Luke Zhang [MSFT]
Guest
Posts: n/a
 
      02-06-2007
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/subscripti...ult.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/subscripti...t/default.aspx.
==================================================

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



 
Reply With Quote
 
c676228
Guest
Posts: n/a
 
      02-07-2007
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/subscripti...ult.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/subscripti...t/default.aspx.
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
To convert a one dimensional array into a two dimensional array using C amrutha0303 Software 0 08-03-2010 10:02 PM
How do copy Strings from a single dimensional array to double dimensional array Venkat C++ 4 12-05-2003 09:23 AM
Re: Two dimensional pointers and Two dimensional arrays Icosahedron C++ 8 08-21-2003 05:15 AM
Re: Two dimensional pointers and Two dimensional arrays John Harrison C++ 4 08-19-2003 04:00 PM
Re: Two dimensional pointers and Two dimensional arrays Alf P. Steinbach C++ 0 08-18-2003 08:25 AM



Advertisments