2013年8月30日 星期五

web.config connection string 特殊字元當密碼

connectionString="Server=dbsrv;User ID=myDbUser;Password=somepass"word" " = " http://en.wikipedia.org/wiki/Character_entity#XML_character_entity_references

web.config

可加密資料庫字串

2013年8月13日 星期二

[VB.Net]SqlDataAdapter的逾時設定

Using da As SqlDataAdapter = New SqlDataAdapter(_strSql, conn)
da.SelectCommand.CommandTimeout = 120
da.Fill(ds, "testDs")
End Using

2013年8月8日 星期四

[VisualBasic] Unicode碼 轉Unicode中文字

fso.CreateTextFile("c:\test.txt", True, True) 'unicode文字檔
 fso.OpenTextFile("c:\test.txt", ForAppending, True, TristateTrue)

str:待轉換的中文+Unicode編碼


Function Convert(str)

str = Trim(str)

Dim name As String

If InStr(1, str, "&#", 0) > 0 Then '表示有待轉換的編碼

Dim tempArr, tempArr2

tempArr = Split(str, "&#")

For i = 0 To UBound(tempArr)

If IsNumeric(tempArr(i)) Then
name = name & ChrW(tempArr(i))
Else
tempArr2 = Split(tempArr(i), ";")

For j = 0 To UBound(tempArr2)

If IsNumeric(tempArr2(j)) Then
name = name & ChrW(tempArr2(j))
Else

name = name & tempArr2(j)

End If

Next

End If

Next

Convert = name
Else
Convert = str

End If

End Function