I'm working on an ASP.Net project to display information on a website from a database. I want to select the top 10 items from a news table but skip the first Item and I'm having some problem with it.
I am creating an Asp.net web site which will support dynamic data. When I am creating a dynamic web site from Scratch (from template in VS) all is working fine. But when I am trying to add dynamic entity (.edmx) file and running the application I am getting following error
"The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'. "
I have a SELECT query which grabs data from two different tables however when I run the query the CurrentCallOwner often pulls up the same name twice albeit with a different SLAFailed value. What I am trying to do is bind those two values into one. I thought that running a subquery and using a count would solve this however I all receive are a bunch ones. Do you know how I could bind those values into a single value (i.e. add them up?)
SELECT CurrentCallOwnerx, SLAFailed, COUNT(CurrentCallOwnerx) AS Expr1 FROM (SELECT BSFLBWF_1.CurrentCallOwnerx, COUNT(BSFLBWF_1.Incidentx) AS SLAFailed FROM .SRFILE INNER JOIN BSFLBWF AS BSFLBWF_1 ON BSFLBWF_1.Incidentx = SRFILE.SRONUMBER WHERE (SRFILE.SR_GROUP = '38') AND (BSFLBWF_1.KPIFailx = '1') OR (BSFLBWF_1.SchoolChargex > '0.00') OR (BSFLBWF_1.LANMLEChargex > '0.00') GROUP BY BSFLBWF_1.CurrentCallOwnerx UNION SELECT BSFWES_1.CurrentCallOwnerx, COUNT(BSFWES_1.Incidentx) AS SLAFailed FROM SRFILE AS SRFILE_1 INNER JOIN BSFWES AS BSFWES_1 ON BSFWES_1.Incidentx = SRFILE_1.SRONUMBER WHERE (SRFILE_1.SR_GROUP = '38') AND (BSFWES_1.KPIFailx = '1') OR (BSFWES_1.SchoolChargex > '0.00') OR (BSFWES_1.LANMLEChargex > '0.00') GROUP BY BSFWES_1.CurrentCallOwnerx) AS derivedtbl_1 GROUP BY CurrentCallOwnerx, SLAFailed
I have stored procedure which selects records from an SQL table based on a bunch of user-input parameters.Just discovered that if a record in the table has null values in some of the columns (I haven't figured out which ones yet), then the SELECT is not returning the record (even if it satisfies all the parameters).The SELECT statement is supposed to allow for nulls, and I've been over it a bunch of times and am not sure what I'm doing wrong.Or do I need to get rid of all the null values in the SQL table, and prevent new ones from being introduced?
For example I want to get the price of a particular item from table items. I created the connection string and the cmd for the search and put the result in an sqldatareader. How do I put the result in a string so I can use it later? Code so far of what I've done: (Code is in Vb.net)
Dim conn = conn As SqlConnectionNew SqlConnection("Data Source=ComputerSQLEXPRESS;Initial Catalog=database;User ID=id; password=password") Dim cmdSelect As New SqlCommand("SELECT Price FROM Items WHERE Code = Item1, conn) conn.Open() dtrReader = cmdSelect.ExecuteReader While dtrReader.Read lblPrice.Text = dtrReader.GetDouble(0).ToString End While dtrReader.Close() conn.Close()
How would i make a select statement select the row with the nearest values? e.g.: I have 3 labels, labels1 2 and 3, with values of 1.2, 2 and 5.8 In my table i have 4 columns, first is the data im after, and the next 3 relate to the three labels. I want to select one row, where the values of labels match it the closest.......
When Select an entity by linq with entity framework 3.5 ...and thenn select it again using stored procedure ..which change the value for a field for that entity ... i got that with old value ...not procedure value...............When i called that procedure before .. the select ... i got the correct value.........but in my case i shall call the procedure after select with linq statment
Im using SQL Server 2005 and im using stored procedures. Is this possible? i need to get a number of results and do it in one SELECT statement or just one result set. Im using MS Chart Controls for reporting and they cant seem to process multiple result sets this is my problem, so basically to run a barchart i need to assign a column to the X axis and a column to the Y axis and it will then display my results.
My stored procedure below returns a result set with columns subpolicy_name, building_name, floor_name, room_name and total_savings. Im just wondering is it possible to split my total_savings column into 4 columns, for example subpolicy_savings, building_savings, floor_savings and room_savings, i need everything in a separate column. If you run this stored procedure you will see the result set.
It seems like this would be fairly straight forward. I've got a gridview that loads up using one stored proc, but I've got a searchbox to filter the grid, and when the user enters some criteria I want to use a different proc to return the results. Something tells me I should be doing this with one procedure, but I can't seem to make that work either. When the form loads, my grid is populated. And if I leave my search criteria blank and search anyway, my grid is still populated correctly. But if I enter search creteria, I get diddley squat. What gives? Here is the relevent snippets.
I have a button called Next outside the GridView. If I click on Next, I want to highlite the 2nd row and display the details of the 2nd row below in panel. If again I click on Nextm i want to highlite 3rd row and want to display 3rd row results in a panel
I am trying to write a stored procedure that takes out a list of blog entries from a table (tblFeedEntry) as well as the amount of comments that each blog entry has gotten (tblFeedComments) but all I can get is the total amount of comments of all blog entries together, displayed on all entries. This is how my code looks today:
[Code]....
I am guessing that the problem is that the declared variable is not picking up the id of the blog entries, instead it picks up everything. The original select and the select in the declared variable are not connected. How do I connect them?
I am moving to the world of ASP.NET from an Access VBA / VB6 background and having read a few books on the subject I am still confused about communicating with SQL server in VB with ASP.NET.
As a very quick explination I am used to communicating with the server by passing strings containing the data I want to write (or read) such as:
[Code]....
I do not seem to be able to work out from ALAX, Dynamic Data, Bound Controls, DataViews, connecting to services with SOAP, DataSources and all of the other methods of database communication in ASP.NET which is the right system to do the simple reads and writes in SQL that I want to do.
At present I have a page with all of the controls on it required to collect a block of data I want to insert, it is all now fully validated but although I can build the SQL INSERT command in a string I cannot figure out how to fire it over to the local SQL Express server. Am I even doing this correctly or do I need to look at other controls?
I have 2 pages on my site and they are exact duplicates at least on the first part of the page with the exception of declaring an additional arraylist and a databable. Why are the results in my source code of the browser showing doubled up? These results are with the below code and the exit sub right where it is.scotking.comzlinkexchange.comscotking.comzlinkexchange.com
I need to loop through an XML document (no problem over there) and check if a value that i find is already in a (a) tag in a div in my XSL document that i am generating, only if the value is not in that (a) tag i should create a new (a) tag for it and put in in the div that i am checking... how to do it dynamically in XSLT?