You Tube

Friday, 26 June 2020

Best MS SQL Network Setting - All Necessary Step - Full Walk-through


In SQL Configuration Manager
========================
1. Protocol for AL_SQL
2. Named Pipes - Enabled
3. TCP/IP - Enabled
4. Select TCP/IP - GoTo- IP Address - 
5. Scroll Down to Bottom -  Select TCP Port - 1433 


In Control Panel
=============
1. Advance Setting
2. Inbond Rules
3. Port - TCP- 1433
4. Port - UDP- 1434


Sunday, 19 January 2020

Change Date Format (DD - MMM -YYYY) in SQL SELECT Statement - Pick date from SQL database

                 select convert(varchar, getdate(), 1)

Look Carefully at the code... We first need to convert the date in varchar then you need to pick the date. In case you are picking date from database, the code may look like this.

                Select convert(varchar, convert(date,dte), 105) as Date from tbl_name

where dte is column name in SQL Database...
hope this may help... For further query plz comment below...


DATE ONLY FORMATS
Format #QuerySample
1select convert(varchar, getdate(), 1)12/30/06
2select convert(varchar, getdate(), 2)06.12.30
3select convert(varchar, getdate(), 3)30/12/06
4select convert(varchar, getdate(), 4)30.12.06
5select convert(varchar, getdate(), 5)30-12-06
6select convert(varchar, getdate(), 6)30 Dec 06
7select convert(varchar, getdate(), 7)Dec 30, 06
10select convert(varchar, getdate(), 10)12-30-06
11select convert(varchar, getdate(), 11)06/12/30
12select convert(varchar, getdate(), 12)061230
23select convert(varchar, getdate(), 23)2006-12-30
101select convert(varchar, getdate(), 101)12/30/2006
102select convert(varchar, getdate(), 102)2006.12.30
103select convert(varchar, getdate(), 103)30/12/2006
104select convert(varchar, getdate(), 104)30.12.2006
105select convert(varchar, getdate(), 105)30-12-2006
106select convert(varchar, getdate(), 106)30 Dec 2006
107select convert(varchar, getdate(), 107)Dec 30, 2006
110select convert(varchar, getdate(), 110)12-30-2006
111select convert(varchar, getdate(), 111)2006/12/30
112select convert(varchar, getdate(), 112)20061230
TIME ONLY FORMATS
8select convert(varchar, getdate(), 8)00:38:54
14select convert(varchar, getdate(), 14)00:38:54:840
24select convert(varchar, getdate(), 24)00:38:54
108select convert(varchar, getdate(), 108)00:38:54
114select convert(varchar, getdate(), 114)00:38:54:840
DATE & TIME FORMATS
0select convert(varchar, getdate(), 0)Dec 12 2006 12:38AM
9select convert(varchar, getdate(), 9)Dec 30 2006 12:38:54:840AM
13select convert(varchar, getdate(), 13)30 Dec 2006 00:38:54:840AM
20select convert(varchar, getdate(), 20)2006-12-30 00:38:54
21select convert(varchar, getdate(), 21)2006-12-30 00:38:54.840
22select convert(varchar, getdate(), 22)12/30/06 12:38:54 AM
25select convert(varchar, getdate(), 25)2006-12-30 00:38:54.840
100select convert(varchar, getdate(), 100)Dec 30 2006 12:38AM
109select convert(varchar, getdate(), 109)Dec 30 2006 12:38:54:840AM
113select convert(varchar, getdate(), 113)30 Dec 2006 00:38:54:840
120select convert(varchar, getdate(), 120)2006-12-30 00:38:54
121select convert(varchar, getdate(), 121)2006-12-30 00:38:54.840
126select convert(varchar, getdate(), 126)2006-12-30T00:38:54.840
127select convert(varchar, getdate(), 127)2006-12-30T00:38:54.840
ISLAMIC CALENDAR DATES
130select convert(nvarchar, getdate(), 130)date output
131select convert(nvarchar, getdate(), 131)10/12/1427 12:38:54:840AM
You can also format the date or time without dividing characters, as well as concatenate the date and time string:
Sample statementOutput
select replace(convert(varchar, getdate(),101),'/','')12302006
select replace(convert(varchar, getdate(),101),'/','') + replace(convert(varchar, getdate(),108),':','')12302006004426

Sunday, 19 March 2017

make variable available to all windows form c#

Go to Project -> Add Class.  Name your class Variables.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using System.Text.RegularExpressions;
using System.IO;
using System.Net;

namespace MY_namespace
{
    class my_global_Variables
    {
        public static string var1 = "Something";
    }
}

Create a setup project in visual studio ...

Adding Project a Primary Output ...

Add a setup project in your project solution by
Right Click on Solution -> Add -> New project
Add New Project window opens. Select Setup Project by
Other Project Types -> Setup and Deployment -> Visual Studio Installer
Give some name to your setup project and click OK
Setup Project gets added into your project solution.
Right click on your setup project
Go to Add option and then Project Output
Select Primary Output of in the list box and select your application in the top combo box. Now click OK.
Again right click on your setup project and Go to View option and then Custom Actions
Now Custom Actions window gets opened. Right click the Custom Actions and then Add Custom Action…
A window opens, now you have to double click Application Folder option. Doing this, you get to see Primary output from “Your Project”. Select that option and click OK
You would see that primary output of your project gets added in Install, Commit, Rollback and Uninstall option.
Make sure that your setup project is got added into your project solution. 



Choose What to Install or Download before installing ...

Choose Setup Soltion and then prerequisites ... 
then choose what to install ...

Monday, 13 March 2017

Get Column Names and Column count number in MSSQL ?

For Name Try this :
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.Columns where TABLE_NAME = 'my_table'
 
 
For Column count Try this :
SELECT Count(*) FROM INFORMATION_SCHEMA.Columns where TABLE_NAME = 'my_table'
 

Sunday, 12 March 2017

Change MDI Parent Back Color

Copy Paste this ... 
 
 
MdiClient myMDI;


foreach (Control ctl in this.Controls)
{
   try
   {            myMDI = (MdiClient) ctl;

           myMDI.BackColor = this.BackColor;
   }
   catch (InvalidCastException exc)
   {
      // your code ...
   }         
}

Monday, 27 February 2017

Wednesday, 22 February 2017

Way of tracking previous page asp.net ?

Try This ...
 
 
static string prev = String.Empty; 
 
protected void Page_Load(object sender, EventArgs e)
{
     if( !IsPostBack )
     {
         prev = Request.UrlReferrer.ToString();
     }
 
 }
 
 protected void btn_previous(object sender, EventArgs e)
 {
      Response.Redirect(prev);
 }

Tuesday, 21 February 2017

how to give height that fits the page css ?

Try this:

 

style="height: 100vh;"
 
or
 
html, body {height: 100%;}

or
 
body
{
padding:0px;
margin:0px;
width:100%;
height:100%;
}