‏إظهار الرسائل ذات التسميات Getting. إظهار كافة الرسائل
‏إظهار الرسائل ذات التسميات Getting. إظهار كافة الرسائل

الأحد، 5 يناير 2014

Getting The ORDER BY clause is invalid in views, unless TOP or FOR XML is also specified

I have this SQL Server stored procedure where I am returning an XML type output, however before that I will be updating the corresponding records as well.

ALTER PROCEDURE [dbo].[GetPublishedData](@PublicationURL varchar(100),@Number int) AS IF (@Number = 0) BEGIN BEGIN TRANSACTION TRAN2 SELECT 1 AS Tag, NULL AS Parent, NULL AS [root!1!], NULL AS [Item!2!Id], NULL AS [Item!2!Action], NULL AS [Item!2!Pub_Id], NULL AS [Item!2!Item_Id], NULL AS [Item!2!Item_type], NULL AS [Item!2!Last_Published_Date], NULL AS [Item!2!Url], NULL AS [Item!2!Schema_Id] UNION SELECT 2, 1, '1', T.ID, T.ACTION, T.Pub_Id, T.Item_Id, T.ITEM_TYPE, T.LAST_PUBLISHED_DATE, T.URL, T.SCHEMA_ID FROM DBO.AUTN_ITEMS T WHERE FLAG = 0 AND ACTION IN ('ADD','UPD') AND URL LIKE @PublicationURL + '%' ORDER BY [Item!2!Last_Published_Date] ASC FOR XML EXPLICIT /*Update the FLAG with 1*/ UPDATE DBO.AUTN_ITEMS SET FLAG = 1 WHERE ID IN (SELECT ID FROM DBO.AUTN_ITEMS AT WHERE AT.FLAG = 0 AND ACTION IN ('ADD','UPD') AND AT.URL LIKE @PublicationURL + '%' ORDER BY AT.LAST_PUBLISHED_DATE ASC) COMMIT TRANSACTION TRAN2 ENDRETURN

I have two questions:

How to use Order by in my Update SQLIs there better way to write above query where I can simply pass the transaction id for updating the records

Please suggest!!


View the original article here

الجمعة، 20 ديسمبر 2013

Getting value from dynamic table in Android

This was my code for creating table and appending the data dynamically

table = (TableLayout)findViewById(R.id.table); inflater = getLayoutInflater(); for(int i = 0; i < 5; i++) { row = (TableRow)inflater.inflate(R.layout.row,table, false); TextView text = (TextView)row.findViewById(R.id.text1); text.setText("sss:" + i); text1 = (EditText)row.findViewById(R.id.text2); `enter code here` text2 = (TextView)row.findViewById(R.id.text3); text2.setText(""); text1.addTextChangedListener(new MyWatcher(text2)); table.addView(row); }

this code is working fine but my problem is when i click the button i want to get the values from each row which is to be only filledenter code here

NxtBtn.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { } });

please help me out in this.


View the original article here