Page 1 of 1

Remove Just MySQL datasources

Posted: Fri Jun 01, 2012 5:41 pm
by mmurdock
I currently use this command to clear all of the datasources:

StiReport1.Dictionary.Databases.Clear()

This of course clears all of the databases. Is there a way to just have it clear the MySQL databases and leave all others?

Thanks,

Mat

Remove Just MySQL datasources

Posted: Fri Jun 01, 2012 8:43 pm
by mmurdock
Actually if I could remove the datasource by name that would work.

I tried to do this: StiReport1.Dictionary.Databases.Remove("blah") but I this error "Cannot remove the specified item because it was not found in the specified Collection."


Any help would be great.

Mat

Remove Just MySQL datasources

Posted: Fri Jun 01, 2012 9:30 pm
by mmurdock
Well, this is what I came up with.

Code: Select all


Dim I As Integer = 0

        Dim intOriginalNumberOfConnections As Integer = StiReport1.Dictionary.Databases.Items.Length

        While StiReport1.Dictionary.Databases.Items.Length > I

            If StiReport1.Dictionary.Databases.Item(I).Name = "blah" Then

                StiReport1.Dictionary.Databases.RemoveAt(I)

            End If

            If intOriginalNumberOfConnections  StiReport1.Dictionary.Databases.Items.Length Then

                I = 0

            Else

                I = I + 1

            End If

        End While

Remove Just MySQL datasources

Posted: Sat Jun 02, 2012 1:41 am
by Andrew
Hello,

Do I understand you correct that you found a decision for your question?

Thank you.