Thứ Bảy, 19 tháng 4, 2014

khi nhấn enter sẽ chỏ tới đung nút cần nhấn

if (!IsPostBack)
{
   txtboxFirstName.Attributes.Add("onKeyPress", 
                   "doClick('" + btnSearch.ClientID + "',event)");
} 


<SCRIPT type=text/javascript>
    function doClick(buttonName,e)
    {
        //the purpose of this function is to allow the enter key to 
        //point to the correct button to click.
        var key;

         if(window.event)
              key = window.event.keyCode;     //IE
         else
              key = e.which;     //firefox
    
        if (key == 13)
        {
            //Get the button the user wants to have clicked
            var btn = document.getElementById(buttonName);
            if (btn != null)
            { //If we find the button click it
                btn.click();
                event.keyCode = 0
            }
        }
   }
</SCRIPT>

Thứ Tư, 16 tháng 4, 2014

Thứ Năm, 10 tháng 4, 2014

Lấy ngày đầu tuần và cuối tuần của ngày hiện tại

select dateadd(dd, 1 - DATEPART(dw, GETDATE()), GETDATE()) 
select dateadd(dd, 7 - DATEPART(dw, GETDATE()), GETDATE()) 

Thứ Năm, 3 tháng 4, 2014

Khai báo mảng string trong c#

 string[] digits = { "zero""one""two""three""four""five""six""seven""eight""nine" }
 

Đoạn mã lệnh tạo một bảng mới vào trong một cơ sở dữ liệu

CREATE TABLE Test
(ID INT NOT NULL,
 Name VARCHAR,
 CreatedDate DATETIME,
 ModifiedDate DATETIME)

Lấy tất cả tên các bảng đã được tạo trong một cơ sở dữ liệu

SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA='Test';