SQL Server :: Where Is Statement In XML Explicit
Dec 27, 2010
I've build a query, but the where statement is doing strange things. First my query:
select * from
(
SELECT 1 as Tag, null as Parent, row_number() OVER (ORDER BY tblOccasion.ID DESC) AS [tblOccasion!1!rownum], FROM tblOccasionwhere tblOccasion.UserID = @UserName and ((tblOccasion.MerkDesc like '%' + @search + '%')or(tblOccasion.UitvoeringDesc like '%' + @search + '%')or(tblOccasion.UitvoeringDesc like '%' + @search + '%'))
) AS A where a.[tblOccasion!1!rownum] BETWEEN (@startRowIndex) AND (@startRowIndex+@pageSize)
order by a.[tblOccasion!1!MerkDesc!Element],a.[tblOccasion!1!TypeDesc!Element],a.[tblOccasion!1!UitvoeringDesc!Element]
FOR XML EXPLICIT;
But the result should be ordered by Merkdesc, then TypeDesc, and then as last the uitvoeringDesc.
So for testing i only used the MerkDesc. The strange thing is that i get the result:
BMW
BMW
BMW
Opel
Volvo
But this was page 1, on page 2 (paging) you got BMW again... so he takes the first 5 rows ore something and then the order. But i like that he first orders it by MerkDesc and then picks the first 5. How can i change that, i can't add a Order by in the inline sql statement i get this error: Msg 1033, Level 15, State 1, Procedure MijnAdvertenties, Line 47 De ORDER BY-component is ongeldig in weergaven, in line functies, afgeleide tabellen en algemene tabelexpressies, tenzij ook TOP of FOR XML is opgegeven.
View 1 Replies
Similar Messages:
Mar 8, 2011
I have an insert table with identity specification set. And I getthis error. I'm using a stored procedure to store it. How do I correct it. I'm also using a details view on my insert page.
Exception Details: System.Data.SqlClient.SqlException: Cannot insert explicit value for identity column in table 'Insert' when IDENTITY_INSERT is set to OFF.
View 4 Replies
Sep 25, 2010
have a very important issue,i have three Stored Procedures Sp1,Sp2 and Sp3 .the first one (Sp1) will execute the second one (Sp2) and save returned data into @tempTB1 and the Second one will execute the third one (Sp3) and save data into @tempTB2.if I execute the Sp2 it will works and it will returned me all my data from the Sp3 ,but the problem is in the Sp1, when i execute it it will display this Error:INSERT EXEC statement cannot be nested I tried to change the place of execute Sp2 and it display me another error:Cannot use the ROLLBACK statement within an INSERT-EXEC statement.
View 4 Replies
Feb 27, 2011
The following stored procedure updates the value in LeaveTransaction table.
[code].,...
My Question here:
I have written the above trigger,which would update the value for the corresponding records in another table ie) LeaveCumulative table. The trigger is not updating the value in the designated rows in the leavecumulative table. Whereas when I excute the same update command separately in the Query Editor window the trigger is working fine.
View 1 Replies
May 18, 2010
User controls when rendered generates a dynamic ID for themselves. It makes sense also, as a page might have more than one of such user control and if dynamic id is not generated, there would be an ID conflict. But I am working on a page (legacy page yopu can say :D ) where I really need to specify a specific ID to usercontrol to make existing javascripts work. Is there a way to achieve this? OR if above is not doable (though I prefer it), below I have a dropdown in aspx like
[Code]....
View 4 Replies
Feb 23, 2011
[Code]....
Now,
1. If In transaction scope if 1st Transaction is commited, buting 2nd one exception occurs and it is rolled back
2. Any other exception occurs, after 1st transaction is completed/commited
Here, explicit transactions are used. In both cases does all transactions in the scope are revert back? What are the possiblities here?
View 7 Replies
Dec 2, 2010
I had "Invalid viewstate" error in my application; I found out it's caused by worker process recycling, so I generated a <machinekey> section with explicit validationkey. refer to this link,[URL] My quesitons are 1. I have the application installed on dev, qa, stg and prd servers. Should I use the machinekey with the same(or different) validationkey for all the servers? I think it shouldn't be matter because the servers are independent from each other.
2. Where should I put the <machinekey> section, machine.config or individual application level's web.config? There are multiple applications on the server.
If I put it at the application level, does that mean other applications still may have the same "Invalid viewstate" error?
If I put it at the application level, should I add the <machinekey> section for all the other applications using the same validationkey?
View 1 Replies
Jun 16, 2010
Following the MVC1 vers of Nerddinner, but using 2010 and MVC2. Never seen this error. Looked in controller, model, view. Where does MVC pass the identity value, and how to stop it? I have never had to set IDENTITY_INSERT in any app before.
View 2 Replies
Jan 24, 2010
i wold like to have a requiredfieldvalidator used with explicit localisation. my new code looks like this:
[Code]....
and is showing nothing beside of the image 'fehler.gif'. previously my code was like this and it worked like a charme:
[Code]....
how would like the code correctly?
View 3 Replies
Jan 15, 2011
At University it was suggested to us that the best way to learn about designing and implementing databases is to practice the art. So I chose the following statement to implement and refine my skills:
Harpers Hauliers deliver shipments on contract for customers. Each contract is identified by a unique contract number. The contract may require a single or many shipments. Each shipment must be allocated resources of a vehicle (regisatration number, type, volume, weight), which is suitable for the shipment and a driver (name, address, telephone number) who is licensed to drive that type of vehicle.
As soon as a customer (companyname, address, telephone number) makes an enquiry, a pending contract is set up. The contract is then negotiated on price between the customer and the haulier. Not all pending contracts are successfully negotiated. Either the customer or the haulier may back out at this stage. If the haulier has previously carried for this customer and financial settlements were not made to his satisfaction, he may reject the contract. He may also reject the contract on the basis that he thinks the workload being undertaken is too big a risk for his company with this customer that is the contract is worth more than he is willing to risk for this customer.
An agreed contract requires the haulier to deliver the listed shipments between a start and an end date, at an agreed price. The haulier always takes out an insurance policy on the contract, in case he cannot allocate enough resources to the contract to get it delivered on time.For each shipment in the delivery there is an origin and destination. The shipment has a description, a weight and a volume. The haulier has a fleet of vehicles of different types and a staff of drivers with different license types, to match the vehicle types. During the contract, the haulier tries to allocate vehicle, driver and time-slot resources to each ship-ment. The vehicle must have a suitable volume and weight capacity and the driver must have a suitable license to drive that vehicle.
The time must be when the driver and vehicle are free and before the contract end date. As each shipment is delivered, it is marked off as delivered by the driver, giving the date and time of delivery. If not all shipments are delivered by the contract end date, the con-tract becomes overdue, incurring a penalty cost on the haulier. When all shipments are delivered, the haulier invoices the customer for the required amount. Each invoice is has a date and is identified by a unique invoice number . Payment from the customer may be in full or may be partial. The contract is kept active until all payments have been made against it.
And here is the ERD that I have come up with. I have created the ERD in Visio 2010.
[IMG]http://i56.tinypic.com/6s43t4.jpg[/IMG]
Can someone who's an expert in Database design kindly check my ERD and see if it perfectly matches the Problem Statement.
View 16 Replies
Sep 19, 2010
I have explicitly added __doPostBack() on Button onclientClick event.
<asp:Button ID="Button1" runat="server" Text="Button"
OnClientClick="__doPostBack('Button1','')"/>
When I am clicking the button the Page_Load is calling twice. But if I am adding below code inside page load ,page load is calling only once on button click.
Button1.Attributes.Add("onClientClick", "__doPostBack('Button1','')");
Again if i add with return false it is giving me it calling only once page load on click
<asp:Button ID="Button1" runat="server" Text="Button"
OnClientClick="__doPostBack('Button1','');return false;"/>
and return true is giving me again twice page load ,but adding return true or false in attribute.add code is giving the same result ,only one page load call.
Button1.Attributes.Add("onClientClick", "__doPostBack('Button1','');return true;");
I am not able to understand what is going on exactly when I tried to add __doPostBack in different way.
View 3 Replies
Jul 19, 2010
I am searching for the advantages and disadvantages of the explicit interface implementation
View 1 Replies
Nov 23, 2010
Is there a way to use the .NET ScriptManager in Explicit mode to inlcude the CDN JQuery file(s)? There is plenty of dicussion and information about including the indivudual AJAX framework files such as "MicrosoftAjaxCore.js", but since AJAX uses JQuery, I thought there might be a way to explicitly include the JQuery file(s) using the ScriptManager rather than hard coding an address to the MS CDN.
View 3 Replies
Mar 2, 2010
when trying to translate the confirmation message to Norwegian i get the following error: Cannot have more than one binding on property 'OnClientClick' on 'System.Web.UI.WebControls.LinkButton'. Ensure that this property is not bound through an implicit expression, for example, using meta:resourcekey. i use Explicit localization in the following manner:
<asp:LinkButton ID="lnkMarkInvoiced" runat="server" OnClick="lnkMarkInvoiced_OnClick"
OnClientClick="<%# Resources: lnkMarkInvoicedResource.OnClientClick%>"
Visible="False" CssClass="stdtext" meta:resourcekey="lnkMarkInvoicedResource" ></asp:LinkButton>
here's the local resource file entry:
<data name="lnkMarkInvoicedResource.OnClientClick" xml:space="preserve">
<value>return confirm('Er du sikker?');</value>
if i remove the meta attribute i get the English text(default). how do i get the Norwegian text appearing without resorting to using the code behind? Update: removing the meta attribute prevents the exception from occurring but the original problem still exists. I can't get the Norwegian text to show. only the default English text shows.
Another Update: I know this question is getting old but i still can't get the Norwegian text to display.
View 3 Replies
Jan 11, 2011
I have some problem with the Localization in ASP.net. I have generated the resources and binding the text property by an variable. In the source file.
<asp:Label ID="Label1" runat="server" Text='<%# Eval("name") %>' meta:resourcekey="Label1Resource1"></asp:Label>
code behind
protected string name;
protected void Page_Load(object sender, EventArgs e)
{
name = "Hello World";
}
The above things are simple but when I run the project. I got Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Cannot have more than one binding on property 'Text' on 'System.Web.UI.WebControls.Label'. Ensure that this property is not bound through an implicit expression, for example, using meta:resourcekey. Source Error: The above is just an example what I am facing in my project. how can I make localization and binding both at the same time.
View 3 Replies
May 21, 2010
Right now I'm using the following code in my markup:
<asp:HiddenField ID="TheName" runat="server" Value=<%#Eval("SpeakerName")%> />
I would like to use:
<asp:HiddenField ID="TheName" runat="server" Value=<%#Eval(0)%> />
I would like to be able to call it by index instead of explicitly by "SpeakerName". Is there a way to do this in ASP.NET 4.0?
View 1 Replies
Mar 9, 2011
I have a requirement in my app to find out if a certain row exists in a table and then if it does get some fields from another row
I have two parameters an EventId and a UserId.
This is the normal statement I would use to get that row
[Code]....
Then I would check if the result > 0. If it is greater than 0 this is the statement I would use to get the other details
[Code]....
So how can I join this into one statement? This is what I have tried
[Code]....
View 3 Replies
Nov 9, 2010
I'm trying to pull a list of clients that have both of two codes in the code table. Here is what I have tried and it does not return any rows. I know that there are clients that have both codes.
[Code]....
View 7 Replies
Jul 10, 2010
The wierd thing is this was working fine and then it just started throwing this error,
"Cannot insert explicit value for identity column in table 'Reports' when IDENTITY_INSERT is set to OFF."
Here is the code:
[Code]....
View 6 Replies
Sep 27, 2010
I have to pull up a list of people by their branch number which could vary, and give a detailed report on there performance using a select queries. I have the select queries but how can i create a script to look similar to this one. Ive got the branch drop downlist already created just need to know how i can go about pulling all the users in this group and doing this select to all of them. someone told me I might need to use cursors to loop thru a select with every person in the list but im not sure how to go about that.
select fldusername from tbluser where fldio='o' and
flduserbranch=@branchid
is going to give me the names of the people i need to query. but how can i run a query on each of them seperate?
View 3 Replies
Mar 25, 2011
I want to create a program that allows me to enter the name of a table, a field along with a value. The program should concatenate the values to form a valid SQL select statement. I can also modify the program to include multiple field names and values. Example: -Select "FieldName" from "TableName" where "FieldName"= "Value" I have created 3 textboxes called and 3 labels named Select, From and Where This is my code here, i would need an assistance on the right way to achieve this, maybe mine is wrong.
[Code]....
View 1 Replies
Jan 29, 2011
Here is the deal. I need to create a Stored Procedure that has 2 SELECT statements. Now in ASP.NET, I know that a DataSet can have multiple tables and the DataAdapter can do just that. I am stuck with a scenario where I need to get a value from the first SELECT statement which will later be used in the second SELECT statement. I am creating a SP that passes one parameter (@AnswerID). Which should give me 2 resultsets. See below SELECT statements.
[Code]....
So how do I get the QuestionID from the first SELECT statement?
Basically I am creating a Questionnaire that has Question Dependacies. So from the above SQL statements I would like to display the Question Title with it's relevant answer options but depending on the previous Answer selected hence the @AnswerID parameter.
The reason why I want to use 2 SELECT statements is because I don't want to have 2 roundtrips to th server. So in my code the DataAdapter should return 2 resultsets and fill the DataSet.
If there is any another solution that can prevent 2 roundtrips to the server, I would most definitely like to know how to do it.
View 10 Replies
Mar 30, 2011
n my button_click event, I have three data connections being opened and closed... I'm wondering... should I have one try/catch statement with the three connections and executions in the single try/catch... or should I have a try/catch statement for each connection/execution?
View 9 Replies
Jul 21, 2010
Here's my SQL Statement
[Code]....
Unfortunately, I get the following error message:Message="The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified."
View 3 Replies
Feb 14, 2011
I have a select statement:
cmd = new SqlCommand("select lab_key from tblorderwhere", connection);
I would like to add a where statement that pass variable to the select statement. How I can do this?
Where lab_key =ChargeFine( that is my variable)
View 2 Replies