P
poppybush
I am currently writing a piece of software that allows an administrator
to remove 'n' amount of software licenses from a database. Let's say
that they want to delete 6 instances of MS Access and there are 10 in
the database; there should be 4 left over. If I loop through my SQL
string 6 times with the following SQL string it will delete ALL
instances of Microsoft Access in the database:
For i = 1 To intNumToDelete
strSQL = "DELETE * FROM tblSoftware WHERE SoftwareTitle = '" &
strSoftwareTitle & "';"
Dim objCommand As New OleDb.OleDbCommand(strSQL, objConn)
objCommand.ExecuteNonQuery()
Next
I can't seem to figure out a way to only delete 6 of them. If worst
comes to worst I could do the following:
1) subtract intNumToDelete from intMaxToDelete (count of MS Access)
2) DELETE all instances of MS Access and then
3) INSERT the difference from 1
There has got to be a simpler way to achieve this. Any suggestions?
to remove 'n' amount of software licenses from a database. Let's say
that they want to delete 6 instances of MS Access and there are 10 in
the database; there should be 4 left over. If I loop through my SQL
string 6 times with the following SQL string it will delete ALL
instances of Microsoft Access in the database:
For i = 1 To intNumToDelete
strSQL = "DELETE * FROM tblSoftware WHERE SoftwareTitle = '" &
strSoftwareTitle & "';"
Dim objCommand As New OleDb.OleDbCommand(strSQL, objConn)
objCommand.ExecuteNonQuery()
Next
I can't seem to figure out a way to only delete 6 of them. If worst
comes to worst I could do the following:
1) subtract intNumToDelete from intMaxToDelete (count of MS Access)
2) DELETE all instances of MS Access and then
3) INSERT the difference from 1
There has got to be a simpler way to achieve this. Any suggestions?