CREATE FUNCTION [dbo].[Check_ID] 
(
 @ID nvarchar(10)
)
RETURNS nvarchar(20)
AS
BEGIN
declare @i int,@j int,@Total int,@ID1 nvarchar(1),@info nvarchar(20);
set @i=8;set @j=2;Set @Total=0;set @info='';
if(LEN(@ID)!=10)
begin
 set @info=N'字串不為10碼!';
end
else 
begin
set @ID1=SUBSTRING(@ID,1,1);
--
set @Total=(case when @ID1='A' then 1--'10' 1*[1]+0*[9]
            when @ID1='B' then 10--'11' 1*[1]+1*[9]
            when @ID1='C' then 19--'12'
            when @ID1='D' then 28--'13'
            when @ID1='E' then 37--'14'
            when @ID1='F' then 46--'15'
            when @ID1='G' then 55--'16'
            when @ID1='H' then 64--'17'
            when @ID1='J' then 73--'18'
            when @ID1='K' then 82--'19'
            when @ID1='L' then 2--'20'
            when @ID1='M' then 11--'21'
            when @ID1='N' then 20--'22'
            when @ID1='P' then 29--'23'
            when @ID1='Q' then 38--'24'
            when @ID1='R' then 47--'25'
            when @ID1='S' then 56--'26'
            when @ID1='T' then 65--'27'
            when @ID1='U' then 74--'28'
            when @ID1='V' then 83--'29'
            when @ID1='X' then 3--'30'
            when @ID1='Y' then 12--'31'
            when @ID1='W' then 21--'32'
            when @ID1='Z' then 30--'33'
            when @ID1='I' then 39--'34'
            when @ID1='O' then 48--'35'
            else -1 end)
if(@Total=-1)
begin
 set @info=N'第一碼不是英文!';
end
else
begin
if(SUBSTRING(@ID,2,1) not in ('1','2'))
begin
 set @info=N'第二碼只能 1 或 2 !';
end
else
begin
if (ISNUMERIC(SUBSTRING(@ID,2,9))=0)
begin
 set @info=N'後九碼含非數字!';
end
else 
begin
--
while @i>0
begin
 set @Total=@Total+CAST(SUBSTRING(@ID,@j,1) AS int)*@i;
 set @j=@j+1;
 set @i=@i-1;
end
set @Total=@Total+CAST(SUBSTRING(@ID,@j,1) AS int);
set @Total=@Total%10;
if(@Total=0)
begin
 set @info='1';--驗證OK!
end
else
begin
 set @info=N'驗證失敗!';
end
end
end
end
end
return @info;
END

level168 發表在 痞客邦 留言(0) 人氣()

        protected string GetClientIP()
        {

level168 發表在 痞客邦 留言(0) 人氣()

        protected void btnExcel_Click(object sender, EventArgs e)
        {
            Response.Clear();
            Response.Write("<meta http-equiv=Content-Type content=text/html;charset=utf-8>");//防中文亂碼
            Response.AddHeader("content-disposition", "attachment;filename=xxx.xls");//excel檔名

level168 發表在 痞客邦 留言(0) 人氣()

function isValidURL(url){
    var RegExp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
    if(RegExp.test(url)){
        return true;
    }else{
        return false;
    }
}

level168 發表在 痞客邦 留言(0) 人氣()

contentWindow屬性是指指定的frame或者iframe所在的window對象
在IE中iframe或者frame的contentWindow屬性可以省略,但在Firefox中如果要對iframe物件進行編輯,則必須指定contentWindow屬性。

level168 發表在 痞客邦 留言(0) 人氣()

<embed id='music' src='' hidden="true" loop="true" Volume="0" autostart="false"></embed>
~~~~~~~~~
var moj=document.getElementById('music'),e=''; //抓到物件
e="<table border='1'>"

level168 發表在 痞客邦 留言(0) 人氣()

Dim Db As ADODB.Connection
Set Db = New ADODB.Connection
connstr = "Provider=sqloledb ; Data Source=127.0.0.1,1433;Initial Catalog=dbName;Persist Security Info=True;User ID=123;Password=456"
Db.Open connstr

level168 發表在 痞客邦 留言(0) 人氣()

C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files\Content.IE5

level168 發表在 痞客邦 留言(0) 人氣()

 
select  Rank() OVER (ORDER BY 排序的欄位名稱) AS RowNum from table
 

level168 發表在 痞客邦 留言(0) 人氣()

這個方法必需先建立一個要動態產生的控制項,並將index設成0,然後就可以由程式來動態建立控制項陣列了。
1.在form1建立一個Text1的控制項,將屬性Index設為0,此控制項變成控制項陣列0。
2.利用Load 控制項(index)的方式來建立控制項。
For Example:
在Form_Load中輸入以下程式:
For i = 1 To 10
Load Text1(i)
Set Text1(i).Container = Form1
Text1(i).Left = i * 1000 + 2000
Text1(i).Top = 1500
Text1(i).Text = i
Text1(i).Visible = True
Next i
這樣便會在Form1建立十個text1控制項陣列,加上第一個原本就建立的總共是十一個。
若要使用events來控制,可以輸入以下的程式:
Private Sub Text1_change(Index As Integer)
Select Case Index
Case 0
MsgBox (”The text in the first TextBox has changed”)
Case 1
MsgBox (”The text in the second TextBox has changed”)
Case 2
MsgBox (”The text in the third TextBox has changed”)
End Select
End Sub
程式可以利用控制項的index來做處理。

level168 發表在 痞客邦 留言(0) 人氣()

  Dim   txt1()   As   VB.textbox   
  Dim   i   As   Integer 
  Private   Sub   Command1_Click()
  ReDim   Preserve   txt1(i)   As   VB.textbox

level168 發表在 痞客邦 留言(0) 人氣()

引用 using System.Diagnostics;
ProcessStartInfo Info2 = new ProcessStartInfo();
Info2.FileName = "xxx.bat";//執行的檔案名稱
Info2.WorkingDirectory = @"d:\test";//檔案所在的目錄
Process.Start(Info2);//

level168 發表在 痞客邦 留言(1) 人氣()

1 2 3
Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。