I am using dataset which contains some records I want to query with dataset to get every time next 20 records. I don't want to do it throught loop is there any way that I can get next 20 records everytime.
i have a table for customer forecast with following fields.. customer, year, week, quantity. now i need to write the SP to retrive the records based on the from week,year and to week,year... like this... from 45th week of 2009 to 25th week of 2010. how can write the query...
I have a basic CMS which I'm adding to a site to display some downloads organised into groups. I have two tables, one for the groups and one for the downloads. I'm using a repeated to display the groups with another repeater inside to display the children. This works perfectly.
However some of my download groups may not have any downloads related to them and I'd like to handle this by filter the groups so that only those with a relate download record(s) are shown.
I'm trying to do this with the query which populates the top repeater based on some ideas I read but I must be going wrong with the syntax.
Here is what I'm using to try and only select downloads groups which have downloads linked to them by the download group ID.
Can anyone offer any thoughts on how I should construct the query to perform this?
I know I'm missing something here but I can't figure out what it is. I've got a query joining three tables....accounts, payments, and a table linking the two (there is a M:M relationship).I'm trying to pull a list of all accounts in the account table that have a payment that needs to be resequenced, and also the maximum payment priority if there are any payments that haven't been fully paid. If all payments HAVE been fully paid, I want to return a 0.
It's that last bit of logic that I can't get right. If I include that in the where clause, I get only the accounts that have a payment that hasn't been fully paid. If I take it out, I get all the accounts I get, but I get the highest payment priority whether or not the payment has been fully met.
Here is the query....how do I include the where clause criteria but still include all accounts?
i have a question regarding grid view. i have done almost all work i needed. but one thing i want to do is i have set 4 of page size of grid. so when i show records on the web page i want to set a iframe after first two records then iframe and then two more records like i have shown in the example image. i have used LINQ with C#.how to do it. if you people want i can show you my code.
I have a SQL Data Source that displays records after going through the Query Builder and select "Test Query" yet when I save it, go back to the design mode and select View in Browser I get nothing but a blank screen.
1. I have a GridView on my page and it uses sqldatasource with parameterized query. What I want to do is, on page load (where nothing has been selected so no parameter supplied), I want it to query everything (something like SELECT * FROM [this_table]) but since my SelectCommand is something like
SELECT * FROM [this_table] WHERE [this_column] = @someParameters AND [that_column] = @someParameters.
Can I play around with default value to achieve something like that but how ? Now, when the page loads, it doesn't show anything (No Gridview).
2. On my page, I made something like (username, gender, address, and more) and one single search button. That means, no single control enable auto postback. What I am trying to accomplish is building dynamic query
(if username specifed -> SELECT * FROM [this_table] WHERE [username] LIKE @username).
If both username and gender are specified (SELECT * FROM [this_table] WHERE [username] LIKE @username AND [gender] = @gender) and you know the rest. How can I do this using GridView and SqlDataSource ? To my knowledge, I can only specify one SELECT statement in a sqldatasource.
By right clicking on my database i created a query in server explorer. But where are this query stored can't find them back. I should aspect that their is a folder query's like there is a folder tables but this isn't the case.
I am facing a big problem with simple linq query.. I am using EF 4.0..
I am trying to take all the records from a table using a linq query:
var result = context.tablename.select(x=>x);
This results in less rows than the normal sql query which is select * from tablename;
This table has more than 5 tables as child objects (foreign key relations: one to one and one to many etc)..
This result variable after executing that linq statement returns records with all child object values without doing a include statement.. I don't know is it a default behavior of EF 4.0 . I tried this statement in linqpad also..but there is no use... But interesting thing is if I do a join on the same table with another one table is working same is sql inner join and count is same..but I don't know why is it acting differently with that table only.. Is it doing inner joins with all child tables before returning the all records of that parent table?
Dim MediaQuery = From m In dB.DOWNLOADS _Where m.ID = id _Select
which returns a record from the database. One of the fields in the record is a FK to another table. I need to read this value to be able to set a dropdown based on the ID but I can't work out how to access it. For a standard record I can just do the following txtTitle.Text = MediaQuery.FirstOrDefault().TITLE
However with the foreign key it doesn't work like that. I've tried drpGroup.SelectedIndex = MediaQuery.FirstOrDefault().DOWNLOAD_GROUPS.ID where DOWNLOAD_GROUPS is the FK field but it returns Object reference not set to an instance of an object. If you're simply wanting to read some values from a single db record in the entitiy framework and one is a foreign key how should I go about getting the value?
SELECT TOP 5 * FROM MyTableName WHERE ID=@ID ORDER BY NEWID()
As you may know it gets 5 records by random. I use it with dataset and bind the listview to this dataset and in ItemDataBound i want to do some programming (like making some controls visible or invisible) i need itemindex.
but the question is : how can i get the itemindex of a listview when sql query selects records randomly?