This is a migrated thread and some comments may be shown as answers.

Problem setting datasource programmatically Q2 SP2 2010

6 Answers 151 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Hilda Kenny
Top achievements
Rank 1
Hilda Kenny asked on 04 Oct 2010, 04:44 PM
Hi on the following line I get an error message. (image attached)

bsSearchDebts.DataSource = _DSData

6 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 04 Oct 2010, 04:56 PM
Can you post the whole method please? 
0
Hilda Kenny
Top achievements
Rank 1
answered on 04 Oct 2010, 05:24 PM
Private Sub LoadGrid()
      Dim sSql As String = String.Empty
      Dim sFilter As String = String.Empty
      Dim liRtn As Integer
      Dim DBConn As SqlConnection = DatabaseObject.GetDatabaseConnection()
      Try
          If RadGridViewRequestor IsNot Nothing Then
              bsSearchDebts.DataSource = Nothing
              bsSearchDebts.DataMember = String.Empty
              _DSData.Tables.Clear()
              RadGridViewRequestor.DataSource = bsSearchDebts
              If RadGridViewRequestorDebt IsNot Nothing Then
                  RadGridViewRequestorDebt.DataSource = bsSearchDebts
              End If
              sSql = "SELECT DEBT_ID,DEBT_REFERENCE,FIRST_NAME,SURNAME,ADDRESS_1,ADDRESS_2,ADDRESS_3,ADDRESS_4 FROM TBL_DEBTS " & BuildSql() + " ORDER BY TBL_DEBTS.SURNAME"
              _daDataAdapter = New SqlDataAdapter(sSql, DBConn)
              Try
                  liRtn = _daDataAdapter.Fill(_DSData, "TBL_DEBTS")
              Catch ex As Exception
                  MsgBox(ex.Message)
              End Try
              bsSearchDebts.DataSource = _DSData
              bsSearchDebts.DataMember = "TBL_DEBTS"
              RadGridViewRequestor.DataSource = bsSearchDebts
              If RadGridViewRequestorDebt IsNot Nothing Then
                  RadGridViewRequestorDebt.DataSource = bsSearchDebts
              End If
              CallByName(ParentForm, "Initialise", vbGet)
              Me.RadGridViewRequestor.MasterTemplate.BestFitColumns()
              Me.RadGridViewRequestor.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill
              If RadGridViewRequestorDebt IsNot Nothing Then
                  Me.RadGridViewRequestorDebt.MasterTemplate.BestFitColumns()
                  Me.RadGridViewRequestorDebt.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill
              End If
              If RadGridViewRequestor.Rows.Count > 0 Then Me.RadGridViewRequestor.Rows(0).EnsureVisible()
              CallByName(ParentForm, "SetTotal", vbGet)
          Else
              cbExport.Visible = False
              GetParameters()
              CallByName(ParentForm, "LoadGrid", vbGet)
          End If
      Catch ex As Exception
          MsgBox(ex.Message)
      Finally
          DBConn.Dispose()
          DBConn = Nothing
      End Try
  End Sub
Thanks a lot
0
Richard Slade
Top achievements
Rank 2
answered on 04 Oct 2010, 09:30 PM
Hi,

This really needs to be addressed outside of the Telerik forums as you have a specific binding issues that are not related to the Telerik products, but a quick Google search on your error yielded some interesting results.
This may help
http://www.vbforums.com/showthread.php?t=553638

Richard
0
Hilda Kenny
Top achievements
Rank 1
answered on 06 Oct 2010, 02:06 PM
I appreciate that, but it has only happened after SP2, Maybe there was a windows update or something.
0
Richard Slade
Top achievements
Rank 2
answered on 06 Oct 2010, 02:33 PM
Hi, 

It's a little difficult to tell what is happening but it looks like either your DataSet is going to be empty, or you've lost the data member. 
Richard
0
Julian Benkov
Telerik team
answered on 07 Oct 2010, 05:35 PM
Hi Hilda,

We have not observed similar issues before. Like Richard said, the issue could be related with the DataSet or the internal "TBL_DEBTS" table. Please, check the Rows.Count, Columns.Count properties and try to change the order of setting DataMember and DataSource properties:

bsSearchDebts.DataMember = "TBL_DEBTS"
 
bsSearchDebts.DataSource = _DSData

Please send us your application and we will try to investigate further. I am looking forward to your reply.

Greetings, Julian Benkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Hilda Kenny
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Hilda Kenny
Top achievements
Rank 1
Julian Benkov
Telerik team
Share this question
or