private bool TraceExists(string tracePath) { SqlCommand cmd = MsSqlUtil.NewQuery("select count(*) from sys.traces where path = @tracePath"); MsSqlUtil.AddInParam(cmd, "@tracePath", tracePath); int count = (int)MsSqlUtil.ExecuteScalar(cmd, connInfo.CreateConnectionObject()); return(count > 0); }
private string GetMasterDatabaseFullPath() { // Bernd Linde - Using the Views in 2005 to enable also public logins to trace // Reference: http://msdn.microsoft.com/en-us/library/ms174397(SQL.90).aspx SqlCommand cmd = MsSqlUtil.NewQuery("use master\r\n\r\nselect top 1 rtrim([physical_name])\r\n from sys.database_files\r\n where file_id = 1"); string masterFullPath = string.Empty; masterFullPath = MsSqlUtil.ExecuteScalar(cmd, connInfo.CreateConnectionObject()) as string; return(masterFullPath); }