我可以使用WHERE子句并仍然使用SQLCommandBuilder吗?

时间:2011-06-17 16:04:03

标签: .net asp.net .net-3.5 ado.net

我希望能够执行以下操作,但不确定SQLCommandBulder是否会爆炸。 (我没有设置所有代码来测试它。)

Dim renameFileCmd As SqlCommand = New SqlCommand("select * from FileVersions where vpk = @vpk", sqlConn)
renameFileCmd.Parameters.Add("@vpk", SqlDbType.BigInt)
renameFileCmd.Parameters.Item(0).Value = vpk
renameFileCmd.CommandType = CommandType.Text

Dim renameFileAdptr As SqlDataAdapter = New SqlDataAdapter(renameFileCmd)
Dim renameFileBuilder As SqlCommandBuilder = New SqlCommandBuilder(renameFileAdptr)
Dim renameFileDataTable As DataTable = New DataTable
renameFileAdptr.Fill(renameFileDataTable)

1 个答案:

答案 0 :(得分:0)

根据Henk Holterman的说法。对于SqlCommandBuilder,可以使用简单的Where子句。