When using wizard to add a new Data Source to the project, there are 4 options, one goes for
Database, one goes for
Service, one goes for
Object and the last goes for
Sharepoint. I'm focusing on
Database and
Object, these two options are almost the same in how they get data, both of them use SQL query to fetch data, the difference here is
Database will get data from a procedure or function stored on the server whereas
Object will get data from a method which executes some SQL query remotely. Using two of these options will make me re-create/re-execute my SQL statement to get data, which is very unnecessary because I already have a Dataset filled with data (for displaying in DataGridView), so why the hell do I have to re-execute the exact SQL statement I've executed when filling my Dataset?
To help you image the context more easily, I'll post some code here:
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter("My SQL SELECT query", mySqlConnection);
da.Fill(ds,"myTable");
Now I want to add ds as a new DataSource for my local report, using wizard doesn't seem able to help, the new DataSource I want here can be created through the exact "My SQL SELECT query" above, that means ds is already what I want, however I don't know how to make it available for my local report's data source.
I hope you understand my problem here, I don't want to do thing which has already been done.
Thank you!
VipHaLong.