da = New SqlDataAdapter("select * from revision_cycle_documenttype_mapping where project_id=" & Session("project_id"), con)
cb = New SqlCommandBuilder(da)
ds = New DataSet
da.Fill(ds, "revision_cycle_documenttype_mapping") <<--
mapping_count = ds.Tables("revision_cycle_documenttype_mapping").Rows.Count
Response.Write(mapping_count)
我得到一個錯誤「不正確的語法附近'='」。 我已經展示了哪個部分拋出錯誤,即da.fill。ASP.net數據集
你能幫我嗎?
我會假設會話(「project_id」)爲空或空。您應該使用命令參數而不是內聯SQL來防止可能的SQL注入攻擊。 – 2012-02-16 06:12:03