Forms Data Controls :: Filtering Records Returned Versus Filtering At The Datasource
Mar 14, 2010
I have a standard gridview, with the standard paging and sorting interface enabled.The application holds appointments for three organisational units, with a maximum of 3000 appointment records being returned across all three units. The appointment records are quite small.
The choice I am faced with is to:
1. Have an Org Unit dropdown which returns to the datasource on change of selection and at inital databind, and returns appointment records for one org unit at a time i.e. approx 1000 records.
2. Have the objectdatasource return all 3000 appointment records for all org units at initial databind, and filter the objectdatasource by org unit on change of selection, thereby saving a trip to the datasource.
I guess the question boils down to identifying the point at which querying the datasource by org unit is more efficient than filtering the records returned by org unit.
Is 3000 records a lot for a gridview to be paging and sorting etc.
In our asp.net application, we use Membership.GetAllUsers() in order to allow the administrator work with the site's membership.
Is there a way to filter the rows returned by Membership.GetAllUsers() method? I'd like to be able to have a textbox where (part of) the user's first name / last name is entered and then call GetAllUsers() - or a different method - to get only the users whose name begins with value in the text box.
I am writting a directory website that advertises fitness classes. These classes are listed by Class Type, and Geographical Area. Each Class Type can satisfy one or more of four Fitness Goals such as Loose Weight etc...
I have a table for Classes (classid, classname, classdesc, classtypeid, geoareaid) I have a table for geographic areas (geoareaid, geoarea) And I have a table for ClassTypes (classtypeid, classtypename, classtypedesc)
Which obviously links geographic area via the classes.geoareaid as a forgien key and classtypes by classes.classtypeid as a forgien key.
I can list all classes by type and also by geo area no problem, the problem arrises when I then also want to filter by goal.
The Goals Table (goalid, goal, goaldesc) is linked to the classtypes table via another table classtypes_goals (classtypeid, goalid) as each classtype can satisfy any of the 4 goals.
I am using a DataSet to fetch the data from a Stored Procedure in the SQL Database but because the classtypes can be linked to multiple goals I am getting duplication in my list depending on how many goals a classtype satisfies.
All I need in my data list is class name, class type and area I don't even need to display the goal I just want a drop down above the table that will filter the list and show only classes of classtype that satisfy the goal chosen.
I have two data tables and I need to compare the dataRows and insert all the unequals into a table. See the codes below. Goal: if the checkbox is true I loop through the ItemData table and store that data into x.Data. Next I look for all records that has row("ItemRandomize") = True and finally I add those records to xData table. There is an if statement in my for loop that checks for duplicate records -- This is were the application fails. How to compare both tables and store the unmatched rows. [Code]....
I currently have a common file that's responsible for exporting the users GridView to a CSV file which works fine, mostly. The problem is that it only exports the current gridview display, and being that I have it paged, it can be cumbersome to get all the data to an excel sheet when there can be upwards of 20 pages of data. The GridView has a LINQ datasource as follows
How do I get the results of the preceeding datasource? Or is there a better way to get ahold of that data before it is paged?
I right click on a TableAdapter, select Add Query, select using QueryBuilder, then select a field to filter upon, and add Filter as =@BookStem. Automatically the QueryBuilder adds the WHERE clause to my new query:HERE (BookStem = '@BookStem')When I press OK, I get "BookStem in expression is not part of the query". And filtering doesn't work.
This is not straight forward to explain but basically i want to only get the current weeks data in a table, i.e. if its say thurs or fri and i run the report i just want to filter from the previous Monday every time.
I dont want to use a parameter because there is another table that i want to see ALL data from way back.
So, if i ran the report today (28th april), the table would show Monday (26th), Tuesday (27th) and today Wed (28th).
I'm working on an application that allows our Office Services people to schedule employee location moves. The page I'm currently working on allows for modification of scheduled moves. When the user attempts to save changes in this page, the app runs a stored proc to see if there are any conflicts, e.g., someone already sitting in the new location, someone scheduled to move into the employee's location before the employee is scheduled to move, etc. These conflicts, if any, are then displayed for the user and he/she has to make changes to one or more moves to resolve the conflict. This all works just fine. My problem comes when the user has resolved all the conflicts (or thinks he or she has). I need to check again to make sure that there are not still conflicts somewhere before allowing the data to be saved back to the database. So, I've got data for at least two scheduled moves, but this data does not necessarily match what's in the database.
I want to run the same stored procedure that I initially used on this dataset. The stored proc uses three database tables, plus the proposed move information to check for conflicts. What I'm trying to do (but please tell me if there's a totally different approach that would be better) is I've created 3 DataTables, using the 3 tables that my stored proc uses. The tables are Employee, Location and Moves. I've then put all these tables into a DataSet. I've updated my Moves DataTable with the proposed new move information. Now I want to run my stored proc on this dataset to see if I get any rows (i.e., if there are still any conflicts). But I can't just run the stored proc; it references the tables in the database. I want to run my stored proc on this DataSet. The stored proc is very long and takes 5 parameters which are referenced all through it, so I don't want to just create a DataViewManager using the SQL.
I have a GridView that's currently bound to an ObjectDataSource. I would like to see if it's possible to instead bind it to an EntityDataSource. However, I need to be able to apply custom filters to it.
One of the filters corresponds to a bit / boolean property in the database / EntityDataModel. It has 3 possible selections:
How can I accomplish the same thing in an eSQL Where clause? There is no COALESCE function, is there an equivalent?
i am using gridview control and a linqdatasource and its all working fine and i have added the functionlity of searchingBySubject and i added WhereParameters and than binding my gridview (see the code below) but somehow its not returning any rows and i see i have number of rows based on what i am searching.
I save dates as a string in a varchar data field named "TilDato" in a SQLServer-express table. I want to filter the records smaller than a specific date from a variable in the script. I try the following statement, but it does not seems function logically.
objCmd = new SqlCommand("SELECT * FROM Reservering WHERE @laanedato<=TilDato",myConn2); objCmd.Parameters.Add("@laanedato", laanedato); objRdr = objCmd.ExecuteReader();
Using a dropdownlist, I can filter (by changing datasource) the results based on customer names in a dropdownlist. This datasource, working perfectly, looks like this:
Now, using a textbox and a ajax calendar, I would like to be able to filter on the date as well, but my datasource so far:
doesn't work very good. In some case sit doesnt show anything, in onther situations - with 10 records for a given date, it only shows one.
Question one: How do I make the last datasource work? Its probably - again-again - something with the datetime formats, but for the life of me, I can't see how to do.
Question two: The Ideal solution would be using the first datasource, SqlDataSourceAllLoads, and then be able to filter the results with filterexpressions/parameters, but again, how? The filterparameters would origin from a DropDownListKunder, matching the tblDeliveredInfo.deliveryInfo_FirmaNavn as seen in the second datasource, while the date comes from the textbox txtStartDate (databinding fired by a button).
I have dropdownlist of dates and depending on the date that the user selects from list, I would like to filter records that fall between the startyear and finishyear columns in the datasource. (My the problem is that I do not know how to declare the Startyear and Endyear from the query in the code as they appear underlined - probably the BETWEEN syntax is wrong too).
yYear = DropDownList1.Text Using connection As New SqlConnection("Data Source=CHRIS-PCSQLEXPRESS;Initial Catalog=TorGHL;Integrated Security=True") Dim cmd As String cmd = "SELECT BarDetails.*, MenuHeadingId AS Expr1 FROM BarDetails WHERE (MenuHeadingId = 2)" & "WHERE " & yYear & " BETWEEN " & "(" & StartYear & ")" & " AND " & "(" & EndYear & ")" connection.Open() Dim dapubcb As New SqlDataAdapterDim sqlcomm As New SqlCommand(cmd, connection) dapubcb.SelectCommand = sqlcomm Dim dspubcb As New DataSet("BarDetails") dapubcb.Fill(dspubcb, "BarDetails")
This seems like a stupid, basic question, but I can't find how to do it (plus I've been doing MVC and haven't done in webforms in ages now) - I've got a DataList object that hooks into an SQLDataSource object, and this works fine. However I need to create a second DataList object for a slightly different set of criteria. Rather than creating a second SQLDataSource object and thus calling the DB twice, I would like to make my SQLDataSource object return a broader set of results (this is easy as I am searching on a column, then each DataList is further filtering on another column) and then further filter these results on each respective DataList - how do I do this?
I've been filtering my gridviews with the FilterExpression of the underlying ObjectDataSource etc. I am wondering how I can implement filtering on my GridViews if I just directly databind it to a datatable etc?