+1 800 256 3608 (toll-free in North America) or +49 7531 90 60 10| service@combit.com

MySQL with DbCommandSetDataProvider


(André Vandenbroek) #1

Hi,

I have a working report, binded to a view in a MySQL database. I had to change the view with some extra fields. But in the designer these new fields are invisible. How can I refresh this databinding? My code is like this:

Dim WithEvents LL As New ListLabel
Dim prov As New DbCommandSetDataProvider
Dim Mycmd As New MySqlCommand

Mycmd.Connection = Myconnection
Mycmd.CommandText = "SELECT * FROM MyView WHERE something = true "

prov.AddCommand(Mycmd, “MyView”, “{0}”, “?{0}”)

LL.PreviewControl = Me.ListLabelPreviewControlLlCtl1
LL.AutoProjectFile = “My.lst”
LL.AutoProjectType = LlProject.List
LL.AutoShowSelectFile = True

LL.SetDataBinding(prov)
LL.AutoDestination = LlPrintMode.PreviewControl
LL.Design()

Anyone a solution?

André


(Günther Schwarze) #2

They should be there right from the start. Sorry if this is obvious - are you sure you’re talking about the list of available fields and not the fields you’ve put into your report container?

G…


(André Vandenbroek) #3

Gunther,

Yes, I mean the list of available fields. When I rename the view in MySQL and in the command, start a new report than all fields are available, including the new ones…

This can be a workaround, but not a neat solution. Because I have to create the report again from scratch with all fields and their properties. That is a lot of work.

André


(Günther Schwarze) #4

That’s very strange - could you post one or two screenshots? I’m changing my datasources all of the time and never encountered something like that.

Regarding the workaround, you could use copy & paste to make things easier. However, if the view name changed, you’d need to do a Search & Replace in the project file afterwards. That should save you most of the hassle.


(André Vandenbroek) #5

Search & replace will do for the moment.

I will email some code and screenshots to you.


(André Vandenbroek) #6

Gunther,

I found out what happens. I think it’s an unexpected behaviour of the LL dotnet component, at least for me.

In the shown event of my form, the dataprovider adds the command and the output goes to a previewcontrol by a LL.print command. From that moment on when opening the designer, only the fields which are used in the pagelayout are available, no new fields can be added to the report.

If do not execute the LL.print command after opening a form, than I am able to design the report in a normal way, all fields from the table are available.

Is this ‘normal’ behaviour? In that case I have to change the software in such a way that a LL.design never can be called when a LL.print has been executed.

André


(Günther Schwarze) #7

Intresting indeed. I usually create a new instance of the component for each task - so I haven’t encountered this problem before. Seems like some caching behavior, I know the queries L&L issues are optimized to just select the required fields during printing (there’s even a property called MinimalSelect to disable this feature). Maybe this is not reset after printing?

I would just create a separate instance in your case. However make sure to keep one instance in memory globally to avoid the load-and-unload-overhead. Also, you could report this issue to combit if you want it fixed.

G.