Torna al Thread
Try
reportdoc = New ReportDocument()
Console.WriteLine("Elenco tabelle in " & "(" & rptname & ")")
reportdoc.Load(rptname, OpenReportMethod.OpenReportByDefault)
For i = 0 To reportdoc.ReportClientDocument.DatabaseController.Database.Tables.Count - 1
tbname = reportdoc.ReportClientDocument.DatabaseController.Database.Tables.Item(i).QualifiedName
Console.WriteLine("Table(" & CStr(i) & "): " & tbname)
kv = GetKeyValue(tbname, ".")
If kv(0) = "SCHEMA_DA_SOSTITUIRE" Then
kv(0) = "NUOVO_SCHEMA"
tbname = kv(0) & "." & kv(1)
reportdoc.ReportClientDocument.DatabaseController.Database.Tables.Item(i).QualifiedName = tbname
rptname &= ".new.rpt"
reportdoc.SaveAs(rptname, False)
End If
Next
If rptname.EndsWith(".new.rpt") Then
'ExeLauncher(My.Application.Info.DirectoryPath & "\" & My.Application.Info.AssemblyName & ".exe", "-rpt:" & rptname, True)
End If
Catch ex As Exception
Console.WriteLine(ex.Message & vbCrLf & ex.StackTrace)
Finally
If Not reportdoc Is Nothing Then
reportdoc.Close()
End If
Console.ReadKey()
End Try