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

DataBinding issue with DDL and a List<T>

1 Answer 60 Views
ListControl
This is a migrated thread and some comments may be shown as answers.
Corbin
Top achievements
Rank 1
Corbin asked on 18 Jan 2017, 05:23 PM

I've run into a very strange issue with binding a simple List of objects to a DropDownList. Given the following code: 

 

this.myDDL.DataSource = null//in here to make sure any pre-existing source isn't the problem
List<Person> lst = new List<Person>();
var qry = Employees.List(load); //Returns List<Person> with no errors every time
lst.AddRange(qry.ToArray()); //Proof that there are no errors.  lst.AddRange() works flawlessly on the data
this.myDDL.BindingContext = new BindingContext(); //just added this, in case it was the issue
this.myDDL.DataSource = lst;  //bombs.

 

The very strange thing is that the error thrown is an Oracle error.  Normally, I'd be pestering Oracle about it, but the weird bit is that it only throws the error when assigning the datasource.  This doesn't match Oracle error ORA:00933 (SQL Command not properly ended) at all, but that's the error that is thrown.  The unnecessary extra code above is entirely a result of me trying to isolate a cause, but the query itself that runs to fill in one of these objects is a Stored Procedure that is called in our Production environment many times a day in the exact same way.  The object itself is too simple to be the cause:

public class Person
{
      public int ID {get;set;}
 
      public string FullName {get;set;}
 
      public override string ToString()
      {
             return ID.ToString() + "(" + FullName + ")";
      }
 
}

There are no null values in any property of the objects, no nulls added to the list, and the error doesn't occur until Binding.  Does the Telerik RadDropDownList recall the constructor of each object when using a List<T> as a DataSource? If not, why would the error appear when binding instead of when the objects are initially constructed?

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 20 Jan 2017, 09:27 AM
Hello Corbin,

Thank you for writing.  

It doesn't seem to be a problem with RadDropDownList. I would recommend you to iterate the query result and create a new list of Person instances and then set the RadDropDownList.DataSource property. Alternatively, you can test the same scenario with the MS ComboBox.

I have found the following threads related to this problem:
http://www.dba-oracle.com/t_ora_00933_sql_command_ended.htm
http://stackoverflow.com/questions/8940471/sql-error-ora-00933-sql-command-not-properly-ended
http://stackoverflow.com/questions/36706780/sql-error-ora-00933-sql-command-not-properly-ended-00933-00000-sql-command

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
ListControl
Asked by
Corbin
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or