Re: Dynamic Arrays in ASP.NET?

Tech-Archive recommends: Speed Up your PC by fixing your registry



using arraylist insteal of array in dot net
tony
<tjonsek@xxxxxxxxxxxxxx> wrote in message
news:1134077802.393425.64000@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>I am converting an ASP page to asp.net. In this application, a user can
> enter a list of numbers, separated by commas. The relationship involved
> is 1 to M and I never know how many different numbers the user will
> enter.
> I am getting a 'specified cast not valid' error. While I'm not 100% it
> is the array, This is the block of code that I have narrowed down to
> causing the problem.
> I've spent some time reading on the net about the differences in arrays
> in vb.net and am wondering if the split function I am using isn't the
> best route to go.
>
> Please give any pointers about arrays or suggestions for what might
> cause that specific error message.
>
> In old ASP, my code looked like this:
> dim woPrefix
> dim aryWO
> dim I
> woPrefix = "ASHC"
>
> aryWO = split(session("WO"),",",-1)
>
> set rst1 = cmd1.Execute()
> For I = 0 to UBound(aryWO)
> if session("flgType") = "e" or Instr(1,session("WO"),"ASHC") then
> sqlCmd = sqlCmd + "Insert into contractOutWO Values(" &
> session("ID") & ",'" & aryWO(I) & "') "
> else
> sqlCmd = sqlCmd + "Insert into contractOutWO Values(" &
> session("ID") & ",'" & woPrefix & aryWO(I) & "') "
> end if
> Next
>
> This is what I have in my .NET app:
> Dim woPrefix As String
> Dim aryWO As Array
> Dim I As Integer
> woPrefix = "ASHC"
>
> aryWO = Split(txtWO.Text, ",", -1)
>
> SqlSelectCommand1.CommandType = CommandType.Text
> SqlSelectCommand1.CommandText = "Delete from
> contractOutWO where ID ='" & lblID.Text & "'"
> SqlSelectCommand1.ExecuteNonQuery()
> For I = 0 To UBound(aryWO)
> If ddlCOType.SelectedValue = "E" Or InStr(1,
> txtWO.Text, "ASHC") Then
> SqlSelectCommand1.CommandText =
> SqlSelectCommand1.CommandText + "Insert into contractOutWO Values('" &
> lblID.Text & "','" & aryWO(I) & "') "
> Else
> SqlSelectCommand1 =
> SqlSelectCommand1.CommandText + "Insert into contractOutWO Values('" &
> lblID.Text & "','" & woPrefix & aryWO(I) & "') "
> End If
> If Len(SqlSelectCommand1.CommandText) > 0 Then
> SqlSelectCommand1.ExecuteNonQuery()
> End If
> Next
>


.



Relevant Pages

  • Re: memory problem, I guess
    ... If I use part of the data I'm getting the right transform. ... I searched the web and found that the error message is ... Below is the error message I'm getting when I increas my array size: ... trying to use (it would have been good to specify that)? ...
    (comp.lang.fortran)
  • Calling a COM+ component over ASP
    ... I try to call the component over ASP. ... I've got a array in the parameters of the COM+ method. ... string boType, string userName, bool storeDocument, stringparameters) ... Ich benutze JavaScript auf der ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: UDT Array Parameter
    ... It looks like the array passing was already working - it appears that my ... same error message; apparently, the late-bound function is the IsArray ... Private Sub Form_Load ... Dim testAs myTestType, b As Boolean ...
    (microsoft.public.vb.general.discussion)
  • Re: Confused about ATL and SafeArrays
    ... I put together a test method using your sample method, IDL, and .h ... My ASP code looks like this: ... The type mismatch always occurs on the line "result = ... the Array function works to call the method but passing in the name ...
    (microsoft.public.vc.atl)
  • Re: "Flex memory error" woes
    ... as the error message is not very helpful and the program ... which kept all allocated block pointers in an array and before ... NB I do let allocated arrays hold pointers - it seems to work although I ...
    (comp.sys.acorn.programmer)