• own
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

Hi,

 

I am begineer in sales force development. Could you please explain the steps to bind a gridview from sales force contacts object?

 

Thanks in advance.

  • April 17, 2013
  • Like
  • 0

Instead of getting the values for two columns (Id and CreatedDate) I am getting only 1 column called “length” with the numbers of the length.

What I am doing wron here??

 

Private Function GetData() As Boolean

        Cursor = Cursors.WaitCursor

 

        Dim qr As sForce.QueryResult

        Dim queryString As String

 

        Dim list As System.Collections.ArrayList = New System.Collections.ArrayList

        queryString = "select Id, CreatedDate from TH_Revenue_Totals__c"

 

        Try

            qr = binding.query(queryString)

            If Not qr.records Is Nothing Then

                Dim i As Integer

 

                For i = 0 To qr.records.Length - 1

                    Dim rs As sForce.TH_Revenue_Totals__c

                    rs = qr.records(i)

 

                    list.Add(rs.Id.ToString)

                    list.Add(rs.CreatedDate.ToString)

 

                Next

                DataGrid1.DataSource = list

                GetData = True

            Else

                GetData = False

            End If

 

            Return GetData

        Catch ex As Exception

            lblStatus.Text = ex.Message

        Finally

            Cursor = Cursors.Default

        End Try

    End Function

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Call GetData()

 

    End Sub