I have a huge application built in sometime 2009-10 for managing SQL Server stored procedures as well as submitting standard daily statements to the variety of servers and instances I manage.
I don't know if you are going to be able to create all of the container objects that are necessary to work with this.
You have to define the server object you then can pass in SQL code to execute, or go through the many aspects of objects within a server, database, backups, stored procedures, UDF, email, etc.
I generate a string for my "code" that I want executed from my WinForms client.
This is the deadlock count query string:
case "Deadlock Count": SQL.Append("select resource_database_id, d.name, count(*) from sys.dm_tran_locks tl "); SQL.Append("left join sys.databases d on tl.resource_database_id = d.database_id "); SQL.Append("group by resource_database_id, d.name order by 3 desc"); break;
I have a control with a LOT of different code I want to operate. User clicks on Deadlock Count and uses this case statement to render the code that will be run on the instance|database.
This is the code that does the actual run query and show results: try { DataSet ds = db.ExecuteWithResults(sql); dgResult.DataSource = ds.Tables[0];
} catch (Exception ex) { MessageBox.Show(ex.Message, "This was the error you experienced");
}
There are many different types of queries that the db can perform, in this case I want the result set that I am placing in my grid on the form.
On Wed, Apr 29, 2020 at 10:58 AM Tracy Pearson tracy@powerchurch.com wrote:
The COM object you are creating is named "sqlSMO", are you sure this isn't already the object you are looking for?
Tracy
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Paul Newton Sent: Wednesday, April 29, 2020 11:56 AM To: profoxtech@leafe.com Subject: SQL Server Shared Management Objects (SMO)
Hi all
We have been using the following to get a list of available servers loDMO = CreateObject("sqlSMO.Application") loServerList = loDMO.ListAvailableSQLServers
However SQL-DMO was apparently deprecated with SQL Server 2005 and succeeded by SQL-SMO. Has anybody used SQL Server Shared Management Objects in VFP and, if so, can they please give me some pointers on what I need to install and how to implement code to replace that above. Many thanks
Paul Newton
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]