[dba-VB] Sounds easy.... but I'm a kind of getting stuck here...

Gustav Brock gustav at cactus.dk
Thu Apr 5 09:03:15 CDT 2012


Hi Shamil

OK, then the saved query of Access seems to be the solution.
I didn't know that was possible.

/gustav


>>> Salakhetdinov Shamil <mcp2004 at mail.ru> 05-04-12 15:44 >>>
Hi Gustav --

Yes, you can use built-in VBA functions in MS Access backend saved queries and run that queries from within your .NET apps - MS Jet Engine "is aware" of VBA.

>   Date() - [SavedStartDateValue]
> but I doubt Date() is at your disposal.
It isn't - ADO.NET DataSets calculated columns expressions are very limited.

Thank you.

-- Shamil


Thu, 05 Apr 2012 15:20:48 +0200 от "Gustav Brock" <gustav at cactus.dk>:
> Hi Shamil
> 
> OK, seems like you are limited to basic expressions as in the report viewer.
> 
> So your expression could look like:
> 
>   Date() - [SavedStartDateValue]
> 
> but I doubt Date() is at your disposal.
> Anyway, you should be able to sort on [SavedStartDateValue] and not the days' count.
> 
> Don't know if a saved query will do ... does it support functions Of VBA like Date()?
> 
> /gustav
> 
> 
> >>> Salakhetdinov Shamil <mcp2004 at mail.ru> 05-04-12 14:17 >>>
> Hi Gustav --
> 
> Setting cell value in.RowPostPaint works well, but DataGridView is flickering a bit...
> 
> > Not possible to create?
> I meant I can't create a calculated column with a formula as e.g.
> 
>  ([SavedStartDateValue] - DataTime.Today).TotalDays
> 
> Never used that "complex" calculated columns before.
> The set of possible calculated columns expressions seems to be very limited - http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx
> 
> I have also tried to use unbound column and to set its value in .RowPostPaint event - that worked well, DataGridView flickering disappeared but in this case automatic sorting of DataGridView by unbound column isn't working.
> Implementation of manual (custom code driven) sorting seems to be not right way to go as it would be laborious and it would relatively slow comparing to bound columns sorting: the source dataset has more than 10000 rows and the quantity of rows will grow with time - that is a customer requirement...
> 
> So I decided to give-up and to get column values calculated in a back-end MS Access database query...
> 
> Do you expect there could be an effective solution for my case without using calculated columns created in MS Access back-end queries?
> 
> Thank you.
> 
> -- Shamil



More information about the dba-VB mailing list