為了防止SQL Injection 在ASP.NET裡有提供一個機制 使用Parameters來防止惡意的 SQL Injection 以下程式碼將示範如何使用Parameters的add三種方法 來指定「@欄位名稱」的對應值
Private Sub UpdateDemographics(ByVal customerID As Integer, _
ByVal demoXml As String, _
ByVal connectionString As String)
' Update the demographics for a store, which is stored
' in an xml column.
Dim commandText As String = _
"UPDATE Sales.Store SET Demographics = @demographics " _
& "WHERE CustomerID = @ID;"
Using connection As New SqlConnection(connectionString)
Dim command As New SqlCommand(commandText, connection)
' Add CustomerID parameter for WHERE clause.
command.Parameters.Add("@ID", SqlDbType.Int)
command.Parameters("@ID").Value = customerID
' Use AddWithValue to assign Demographics.
' SQL Server will implicitly convert strings into XML.
command.Parameters.AddWithValue("@demographics", demoXml)
Try
connection.Open()
Dim rowsAffected As Integer = command.ExecuteNonQuery()
Console.WriteLine("RowsAffected: {0}", rowsAffected)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Using
End Sub
紀錄一下,免得之後都要再查一次 以下是我的寫法
kingjoy1235 發表在 痞客邦 留言(0) 人氣()
我新架設的網站「呼浩網」歡迎大家來看看喔
當然這個blog還是會繼續經營
kingjoy1235 發表在 痞客邦 留言(0) 人氣()
如何寫程式設定 IE 瀏覽器使用代理伺服器 ( Proxy Server )
<< VB6寫法 >>
kingjoy1235 發表在 痞客邦 留言(0) 人氣()
將ASP.NET註冊到IIS 6.0
無法正常開啟asp或aspx檔
一般安裝IIS 6.0 、.NET Framework 、visual studio 2008 會遇到在網頁上輸入localhost會無法顯示IIS 6.0 歡迎頁面
或是在localhost瀏覽一般的html檔ok,但是只要把檔名改成asp或aspx,就會出現error 500
kingjoy1235 發表在 痞客邦 留言(0) 人氣()
1.建立一個 ashx ,我是建立一個名稱為 Thumbnail.ashx
2.以下為 Thumbnail.ashx 程式碼
kingjoy1235 發表在 痞客邦 留言(0) 人氣()
kingjoy1235 發表在 痞客邦 留言(0) 人氣()
先到官方網站去抓檔案下來
我所使用的版本是v2.2.0.1
kingjoy1235 發表在 痞客邦 留言(0) 人氣()
原文網址:利用asp擷取網頁資料
如何利用ASP抓取網頁資料並且顯示中文的問題,有興趣的歡迎參考:
kingjoy1235 發表在 痞客邦 留言(0) 人氣()
kingjoy1235 發表在 痞客邦 留言(0) 人氣()
kingjoy1235 發表在 痞客邦 留言(0) 人氣()
Web Server(IIS) 角色安裝與設定:
kingjoy1235 發表在 痞客邦 留言(0) 人氣()
kingjoy1235 發表在 痞客邦 留言(0) 人氣()
kingjoy1235 發表在 痞客邦 留言(0) 人氣()
快快丟掉ASP遺留的二十大陳舊習慣
在技術更新的進程中, 仍然有一些人死抱著已經過了氣的東西不放. 也有一些人雖然進入到新的世界, 但仍擺脫不了陳舊的習慣. 我沒有用”陋習”這個詞, 因為我對這個詞也非常反感.
kingjoy1235 發表在 痞客邦 留言(0) 人氣()
kingjoy1235 發表在 痞客邦 留言(0) 人氣()
kingjoy1235 發表在 痞客邦 留言(0) 人氣()
kingjoy1235 發表在 痞客邦 留言(0) 人氣()
續上篇 [ADO.NET] 如何使用 DataAdapter (一)
9.使用SqlDataAdapter 類別更新資料,可參考以 DataAdapter 更新資料來源 (ADO.NET),使用Update 方法從名為 "Table" 之 DataTable 的指定 DataSet 中,為每個插入、更新或刪除的資料列分別呼叫 INSERT、UPDATE 或 DELETE 陳述式。(預設的資料表名稱叫Table)。所以Update方法會將DataTable的資料(你操作的DataGridView就是DataTable)寫到實體的資料庫中。請參考[ADO.NET] 何謂 RowState
kingjoy1235 發表在 痞客邦 留言(0) 人氣()
以下文章轉載於 ASP.NET 專題實務 周老師、吳老師編著
URL = http://www.dotblogs.com.tw/mis2000lab/archive/2008/12/15/ado.net_dataset_insertcommand_1215.aspx
kingjoy1235 發表在 痞客邦 留言(2) 人氣()
kingjoy1235 發表在 痞客邦 留言(0) 人氣()