This may be a very strange question but I am trying to 'obtain' the SQL command for the purpose of reporting.
So say my Microsoft Access Database has a query which when executed, runs this SQL statement:
SELECT Staff.SurName, Staff.ID, Staff.Salary, Staff.StartDate, Staff.JobTitle,
Manager.SurName AS [Manager Surname], Department.DeptName AS [Department Name]
FROM Employee AS Staff, Employee AS Manager, Department
WHERE (((Staff.ManagerID)=[Manager].[ID]) AND
((Staff.DeptID)=[Department].[DeptID]));
I would like my visual Basic application to be able to 'obtain' the SQL statement for ANY given database, provided there is a statement to be obtained(I.e. If the database has any queries, obtain the statement and return it to the application), if the database has no queries, inform the user with a message.
Is this actually possible?
UPDATE:
I am trying to complete this by using the 'GetSchema()' function:
Dim schema As DataTable = con.GetSchema("PROCEDURES")
But the "PROCEDURES" is causing an error, is anyone familiar with the GetSchema() function?
I've tried all sorts in my searching efforts but I've not had any luck, so I came here.
Thanks in advance