On Wed, Mar 28, 2012 at 10:40 AM, gardo <gardo...@gmail.com> wrote:
> Hello everyone, i have a question about if this is possible or maybe
> im wrong , because i try but  the variables not get the values for
> example:
>
> this is an array with 5 variables of my class "Distritos".
>
>  Private Function FieldsDistritos() As ArrayList
>        Dim list As New ArrayList
>        list.AddRange(New String() {Me.codigo, _
>                                    Me.distrito, _
>                                    Me.provincia, _
>                                    Me.departamento, _
>                                    Me.region})
>        Return List
>    End Function
>
> and I do this.
>
>
> Public Sub GetDistrito(ByVal xcod As String)
>        Dim da As New MySqlDataAdapter("select*from t_distritos where
> codigo='" + xcod + "'", cn), dt As New DataTable
>        da.Fill(dt)
>        Dim lfields As New ArrayList, xcolumn As Integer = 0
>        lfields = Me.FieldsDistritos
>        Try
>            If dt.Rows.Count > 0 Then
>                For xfield As Integer = 0 To lfields.Count - 1
>                    lfields(xfield) = dt.Rows(0)(xcolumn).ToString
>                    xcolumn += 1
>                Next
>            End If
>        Catch ex As Exception
>            MsgBox(ex.Message)
>        End Try
>    End Sub
-------------------------

We do something like this:

Public Function Get_InvoiceLines_By_InvoiceID(ByVal var As
InvoiceLinesInfo) As InvoiceLinesInfo()
            Dim params() As SqlParameter = New SqlParameter(0) {}
            params(0) = New SqlParameter("@InvoiceID", var.InvoiceID)
            Dim d As SqlDataReader =
SqlHelper.ExecuteReader(My.Settings.cnRingEDIEngine,
CommandType.StoredProcedure, "InvoiceLines_sel_InvoiceID", params)
            Dim c As New ArrayList
            Try
                While d.Read
                    Dim al As InvoiceLinesInfo = New InvoiceLinesInfo
                    al.InvoiceLineID =
IIf(IsDBNull(d("InvoiceLineID")), 0, d("InvoiceLineID"))
                    al.InvoiceID = IIf(IsDBNull(d("InvoiceID")), 0,
d("InvoiceID"))
                    al.PositionNumber =
IIf(IsDBNull(d("PositionNumber")), "", d("PositionNumber"))
                    al.SequenceNumber =
IIf(IsDBNull(d("SequenceNumber")), "", d("SequenceNumber"))
<skip>
                    c.Add(al)
                End While
                d.Close()
            Catch ex As Exception
                Dim s As String = ex.Message
                Throw New ApplicationException(ex.Message)
            End Try
            Return CType(c.ToArray(GetType(InvoiceLinesInfo)),
InvoiceLinesInfo())
        End Function



-- 
Stephen Russell

901.246-0159 cell

-- 
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to dotnetdevelopment@googlegroups.com
To unsubscribe from this group, send email to
dotnetdevelopment+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net

Reply via email to