ObjectDataSource Control
Five main attributes: TypeNmae SelectMethod UpdateMethod InsertMethod DeleteMethod;
* This control can represent any object. If this object does not support IEnumerable, it will be automatically packaged into the new object for its support;
* Use DataReader whenever possible
public sqlDataReader GetMovies(){ Sqlconnection con =new ... ... con.open(); return cmd.Executereader(CommandBehavior.CloseConnection);}
* WebConfigurationManager. ConnectionStrings ["Movies"]. ConnectionString: Access connection string;
* If a parameter is required in the method bound to this control, the matching is automatically determined through reflection;
* The DataObjectTypeName attribute of DataObjectSource is invalid in the select method, and the class must have a constructor with or without parameters;
* General event organization method: process the insert operation in the ing event, and process the insert error information in the ed event to block the error;
* You can process the constructor with parameters in the OnObjectCreating event.
MoivesByCategroy movies=new MoviesByCategory("Adventure");e.ObjectInstance=moives;
* The above event is not triggered when a static method is called;
* Create a custom ObjectDataSource control Page 519