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

Salakhetdinov Shamil mcp2004 at mail.ru
Thu Apr 5 16:58:34 CDT 2012


Hi Gustav --

> I didn't know that was possible.
Yes, you can create queries in an MS Access back-end which use built-in VBA functions and run that queries from within your C# apps.
I do not know exactly what subset of built-in VBA functions can be used in saved queries.
So far I have only used IIF, ISNULL and DATEDIFF...

You can also run dynamic SQL queries built in C# on run-time, which have built-in VBA functions...

AFAIU MS Jet Engine does call/interpret built-in VBA functions while processing a saved or dynamic query...

You can also use IN clause  in C#  OleDb queries' text , e.g., to have tables from several MS Access databases joined...

Thank you.

-- Shamil


Thu, 05 Apr 2012 16:03:15 +0200 от "Gustav Brock" <gustav at cactus.dk>:
> 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
> 
> _______________________________________________
> dba-VB mailing list
> dba-VB at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-vb
> http://www.databaseadvisors.com
> 
> 



More information about the dba-VB mailing list