Solved

DBCC DBREINDEX  and VB6

Posted on 2006-11-21
3
653 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
  • 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 500 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

713 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