SELECT REPLACE(CONVERT(VARCHAR, CONVERT(MONEY, TotalArea), 1), '.00', '')
FROM table
Saturday, December 14, 2019
thousands separator for a column
Wednesday, December 4, 2019
MSQL password reset cmd
C:\WINDOWS\system32>Osql -S [computer_name] -E
1> EXEC sp_password NULL, ’123456’, ’sa’
Monday, December 2, 2019
FileUpload Control in Update Panel using ASP.NET AJAX
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server"><title>Untitled Page</title>
</head>
<body><form id="form1" runat="server"><asp:ScriptManager ID="ScriptManager1" runat="server" /><div><table width="50%" cellpadding="2" cellspacing="0"><tr><td><asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="conditional"><ContentTemplate><asp:FileUpload ID="FileUpload1" runat="server" /><asp:Button ID="Upload" runat="server" Text="Upload" OnClick="Upload_Click" /><br /><asp:Image ID="NormalImage" runat="server" /></ContentTemplate><Triggers><asp:PostBackTrigger ControlID="Upload" /></Triggers></asp:UpdatePanel></td></tr></table></div></form>
</body>
</html>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server"><title>Untitled Page</title>
</head>
<body><form id="form1" runat="server"><asp:ScriptManager ID="ScriptManager1" runat="server" /><div><table width="50%" cellpadding="2" cellspacing="0"><tr><td><asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="conditional"><ContentTemplate><asp:FileUpload ID="FileUpload1" runat="server" /><asp:Button ID="Upload" runat="server" Text="Upload" OnClick="Upload_Click" /><br /><asp:Image ID="NormalImage" runat="server" /></ContentTemplate><Triggers><asp:PostBackTrigger ControlID="Upload" /></Triggers></asp:UpdatePanel></td></tr></table></div></form>
</body>
</html>
Friday, November 29, 2019
Getting DataKeyNames for row on button click
protected void viewHoursButton_OnClick(object sender, EventArgs e)
{
Button btn = sender as Button;
GridViewRow row = btn.NamingContainer as GridViewRow;
string pk = storyGridView.DataKeys[row.RowIndex].Values[0].ToString();
System.Diagnostics.Debug.WriteLine(pk);
}
GridView button click event (sender)
TextBox txt = (TextBox)sender;
GridViewRow gvRow = (GridViewRow)txt.Parent.Parent;
DropDownList ddl=(DropDownList)gvRow.FindControl("ddl");
Select the first day of a month in SQL
Month First Day
SELECT DATEADD(month, DATEDIFF(month, 0, @mydate), 0) AS StartOfMonth
SELECT DATEADD(yy, DATEDIFF(yy, 0, GETDATE()), 0) AS StartOfYear, DATEADD(yy, DATEDIFF(yy, 0, GETDATE()) + 1, -1) AS LastDayOfYear, DATEADD(yy, DATEDIFF(yy, 0, GETDATE()) + 1, 0) AS FirstOfNextYear, DATEADD(ms, -3, DATEADD(yy, DATEDIFF(yy, 0, GETDATE()) + 1, 0)) AS LastTimeOfYear
Thursday, November 28, 2019
How to stop browser closing automatically when you stop debugging on VS 2017
Disabling the following checkboxes will allow you to keep the browser open (doesn't close after stop debugging) and opens another tab (instead of another window)
Tools > Options > Debugging > General
- Disable "Enable JavaScript debugging for ASP.NET (Chrome, Edge and IE)".
Tools > Options > Projects and Solutions > Web Projects
- (Visual Studio 2017) Disable "Stop debugger when browser window is closed".
- (Visual Studio 2019) Disable "Stop debugger when browser window is closed, close browser when debugging stops".
Sunday, November 24, 2019
windows port kill command
Port Kill Command
C:\windows\system32>netstat -a -n –o
taskkill -f /pid 19796
Subscribe to:
Posts (Atom)
base 64 convert to image
public Image LoadImage() { //data:image/gif;base64, //this image is a single pixel (black) byte[] bytes = Convert.FromBase6...
-
Port Kill Command C:\windows\system32>netstat -a -n –o taskkill -f /pid 19796
-
public Image LoadImage() { //data:image/gif;base64, //this image is a single pixel (black) byte[] bytes = Convert.FromBase6...
-
TextBox txt = (TextBox)sender; GridViewRow gvRow = (GridViewRow)txt.Parent.Parent; DropDownList ddl=(DropDownList)gvRow.FindContro...