Solved

DBCC DBREINDEX  and VB6

Posted on 2006-11-21
3
650 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

809 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