Trying to run DBCC SHRINKFILE from ADO Connection
Posted on 2006-07-07
And the application kicks an error indicating the _log file wasn't found.
Here is the rub, I have 5 databases. The other four run a-ok. I can also run the shrinkfile command in Query Analyzer, but it simply will not run in my VB application (it's a database copy utility).
This is the code I am running:
Call CreateConnection(oConn, 600)
oConn.Execute "DBCC SHRINKFILE (" & sLogFileName & ",10)"
I run a backup with truncate only before I do this... and the whole process is dependant on the size of the log file being over 12800 units. I get the log file name from the size check query.
It kicks back error number -2147217900. File not found. It is there! I have checked the DB properties in Enterprise Manager!