Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

DBCC DBREINDEX  and VB6

Posted on 2006-11-21
3
Medium Priority
?
668 Views
Last Modified: 2013-12-25
When you run
DBCC DBREINDEX ('pubs.dbo.authors', UPKCL_auidind, 0)
In Enterprise Manager you get the following results

DBCC execution completed. If DBCC printed error messages, contact your system administrator.


QUESTION:
How do you run a query in VB to return the above results

SQL= "DBCC DBREINDEX ('pubs.dbo.authors', UPKCL_auidind, 0)"

conn.Execute SQL, lRet  
' Returns a -1

rs.Open SQL, conn, adOpenForwardOnly, adLockReadOnly
' Does not return anything




0
Comment
Question by:PhilChapmanJr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 29

Expert Comment

by:Nightman
ID: 17988897
I'm not sure about the return value, but try this:

SQL= "DBCC DBREINDEX ('pubs.dbo.authors', UPKCL_auidind, 0) WITH TABLERESULTS "
rs.Open SQL, conn, adOpenForwardOnly, adLockReadOnly

0
 
LVL 2

Author Comment

by:PhilChapmanJr
ID: 17989042
adding WITH TABLERESULTS  to the query does not return anything when
rs.Open SQL, conn, adOpenForwardOnly, adLockReadOnly
is run
0
 
LVL 29

Accepted Solution

by:
Nightman earned 1000 total points
ID: 17989732
It appears that DBCC REINDEX does not output anything but messages (won't even output WITH TABLERESULTS). Not sure that you can do this from ADO. It might be worth looking at using the SQLDMO object - I'm pretty sure that would be able to provide the results that you are looking for.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question