Remove Just MySQL datasources

Stimulsoft Reports.NET discussion
Post Reply
mmurdock
Posts: 94
Joined: Tue Mar 20, 2007 4:59 pm

Remove Just MySQL datasources

Post 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
mmurdock
Posts: 94
Joined: Tue Mar 20, 2007 4:59 pm

Remove Just MySQL datasources

Post 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
mmurdock
Posts: 94
Joined: Tue Mar 20, 2007 4:59 pm

Remove Just MySQL datasources

Post 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
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Remove Just MySQL datasources

Post by Andrew »

Hello,

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

Thank you.
Post Reply