Skip to main content

Posts

Example of join table with subquery result in sql

Following is example that how to join table in sql using select query to retrieve rows from both tables. select * from  First_table as T1 ,Second_table as T2  where T1.wono=T2.wono and T1.id = (select top(1) id from   First_table as T1) In above query T1 is alias name of first table and T2 is alias name for second table. Wono is primary column which used to join both table. It also example of sub query.

How to Set Default Limit in Store Procedure in SQL

This is stored procedure which show you rows return as per mention in stored procedure. CREATE PROCEDURE get_categories( IN p_action_flag VARCHAR(50), IN p_firstrow int, IN p_lastrow int) BEGIN IF p_action_flag = 'all' THEN SELECT top 50 u.*, d.name, d.image FROM user u, member gu, detail d WHERE u.user_id = gu.user_id AND u.user_id = d.user_id AND u.status = '1' AND gu.group_id IN (1, 7) GROUP BY u.user_id ORDER BY d.name LIMIT p_firstrow,p_lastrow; ELSEIF p_action_flag = 'Most Viewed' THEN SELECT top 50 u.*, d.name, d.image FROM user u, member gu, detail d WHERE u.user_id = gu.user_id AND u.user_id = d.user_id AND u.status = '1' AND gu.group_id IN (1, 7) GROUP BY u.user_id ORDER BY u.views DESC, d.name ASC LIMIT p_firstrow,p_lastrow ; END IF END

simple macro that display assigned macros for each Button

 run the following simple macro that display assigned macros for each Button:  Sub ButtonOnAction() Dim shp As Shape Dim i As Integer For Each shp In ActiveSheet.Shapes ' Type 8=Button, 13=Picture, 4=Comment, ... '-- i = 1 If shp.Type = 8 Then ' 8 = Button Application.Goto Reference:=shp.TopLeftCell, Scroll:=True shp.Select MsgBox i & ". Button '" & shp.Name & "' - Macro: '" & shp.OnAction & "'" i = i End If Next shp End Sub

Data from Excel Sheet to Display In C#.Net Datagrid View

select data from an excel sheet and display it in a datagridview public void ImportExcel2007(string path) { FileInfo filePath = new FileInfo(path); DataTable workSheetsTable = new DataTable(); DataTable columnsTable = new DataTable(); string connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties='Excel 12.0;IMEX=1; HDR=YES'"; OleDbConnection excelConnection = new OleDbConnection(connString); excelConnection.Open(); //This bit assumes the first worksheet is the one to import, //change this as required. workSheetsTable = excelConnection.GetOleDbSchemaTable(OleDbSchemaGui d.Tables, null); string tableName = workSheetsTable.Rows[0]["TABLE_NAME"].To String(); //This section uses the tableName declared above to get a //list of columns for that worksheet only. columnsTable = excelConnection.GetOleDbSchemaTable(OleDbSchemaGu

Convert to proper case using dotnet code

Convert to proper case using dotnet code string sentence= "santro is my favorite car"; Response.Write(ConverTopropercase(sentence)); private static string (ConverTopropercase(string senstr) { return Regex.Replace(s, @"\b[a-z]\w+", delegate(Match yourMatch) { string Tempstr = yourMatch.ToString(); return char.ToUpper(Temp[0]) + Tempstr.Substring(1); }); } output: Santro Is My Favorite Car.

Dotnet Code to get size of Folder including subfolders

Dotnet Code to get size of Folder including subfolders Public Shared Function GetSize(ByVal folderFullPath As String, Optional ByVal includesubFolderss As Boolean = True) As Long Dim sizeoffile As Long = 0 Dim directory As directoryInfo = New directoryInfo(folderFullPath) For Each fileInfo As System.IO.FileInfo In directory.GetFiles() sizeoffile += fileInfo.Length Next If includesubFolderss Then For Each subFolders As System.IO.directoryInfo In directory.Getdirectoryctories() sizeoffile += GetSize(subFolders.FullName) Next End If