Dim sSelect As String = _
"SELECT * FROM Contacts" & _
" WHERE DataSetID = @DataSetID AND ID >= @FirstID AND ID <= @LastID ORDER BY ID"
Dim dsDBFiles As New DataSet()
Dim cmd As New SqlClient.SqlCommand(sSelect, m_connection)
cmd.Parameters.Add("@FirstID", SqlDbType.Int).Value = nFirstID
cmd.Parameters.Add("@LastID", SqlDbType.Int).Value = nLastID
Dim daTable As New SqlClient.SqlDataAdapter(cmd)
Dim bldr As New SqlClient.SqlCommandBuilder(daTable)
daTable.Fill(dsDBFiles, sTable)
Dim tbl As DataTable = dsDBFiles.Tables(sTable)
Dim rdr As New Data.DataTableReader(dsFiles.Tables(0))
dsDBFiles.Load(rdr, LoadOption.Upsert, tbl)
daTable.Update(dsDBFiles, sTable)
Is there way to achieve this upsert functionality without retrieving the records ? I am using SQL Server 2005. I heard there is a way to use the sqladapter to do this, without running the select statement.
I am trying to speed up this process. Any suggestions?
Cheers.