Our application development team is experienced in VB.Net. But we get most of the sample on internet developed in C#.
While searching google for C# to VB.Net Convertor, I end up with this
Our application development team is experienced in VB.Net. But we get most of the sample on internet developed in C#.
While searching google for C# to VB.Net Convertor, I end up with this
Finding out Nth Maximum or Nth Minimum from Table's Column
For Finding Nth Maximun
Declare @ int
Set @n=5
Purpose: To find out the nth highest number in a column. E.g.: Second highest salary from the salaries table
The following SQL statement is taken from
http://vyaskn.tripod.com/code/nth.txt
Although this statement is efficient than the First one. But first one is more manageable like what about finding minimum.
In case of (1) simply change >= into <= that's it.
In case of (2) change Max into Min and DESC with space
And more expandable too. like what about this query find out the details of maximum nth sale/salary etc.
In case of (1) Replace qty of outer query with *
In case of (2) Put (2) as subquery as follow
select * from tablename where qty = ( (Query2) )
select * from tablename where qty in ( (Query2) )
Solution
In SQL server 2000 I was trying to import an xls file into a table.
SELECT * into TempData FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\Data1.xls', [Sheet1$])
It worked with sa login, but with other users/login it gave error
"Ad hoc access to OLE DB provider [Microsoft.Jet.OLEDB.4.0] has been denied.
You must access this provider through a linked server"
This problem can be solved by
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Providers \Microsoft.Jet.OLEDB.4.0]
"AllowInProcess"=dword:00000001
"DisallowAdhocAccess"=dword:00000000
The last line does the trick. If DisallowAdhocAccess is absent, it defaults to 1.
Perhaps the most popular way to pass data between web-pages is by using querystring. This is used to both pass data to a new pop-up window, as well as to navigate between pages.
Querystring passes data in name value pair , where names are separated by &. So querystring would be something similar to
name1=value1&name2=value2 etc . Now if the value itself contains & ,then wrong values would be extracted
Go through this link http://www.blooberry.com/indexdot/html/topics/urlencoding.htm to know why we need urlencoding.
This method is good for passing simple alpha-numeric data, but it can be a problem to pass special characters in the URL, especially in different browsers.
· An ampersand would split the name-value pairs. (If you want to pass the value "Johnson&Johnson baby", but the & indicates a new name-value pair, then the value will be truncated to just " Johnson ". For example, in "id= Johnson&Johnson baby ", getting the querystring "id" will return just " Johnson ", and "Johnson baby" will be interpreted as its own key.
· Apostrophes, greater than or less than signs may be interpreted as a cross-site scripting attack by some security plug-ins. As a result, these plug-ins may block the entire page.
· Other special characters (like slash or space) may be lost or distorted when sending them into a url.
Fortunately there is a solution to handling special characters. .Net provides us the ability to Encode and Decode the URL using System.Web.HttpUtility.UrlEncode and HttpUtility.UrlDecode
(note that HtmlEncode, which encodes html, and won't affect the &.). This replaces problematic characters with URL-friendly equivalents.
I hope it help fellow programmers .