Results 1 to 5 of 5

Thread: Can you avg. a column in a datatable?[RESOLVED]

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2002
    Posts
    54

    Question Can you avg. a column in a datatable?[RESOLVED]

    Hello. Is there a way to avg. a specific column in a datatable then display the results in the datagrid? Also, i am building a reports application. Whats the best feature to use in vb.net that isn't a third party software or add in. I am thinking about using a dataview and then SQL select statements to allow the user to select the report criteria. Much thanks!

    Nintendo_Wizard
    Last edited by Nintendo_Wizard; Jan 16th, 2003 at 12:27 PM.

  2. #2
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    Select Avg(mytable.mycolmn) As clmAvg from .....

    See some SQL tutorials like this for more help on aggregate functions.

    There is an article on printing in .NET available in MSDN.

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2002
    Posts
    54

    Talking

    Thanks Lunatic3! That SQL site helped out alot! I was leaving off the ; at the end. One quick question, you could save me alot of trial & error. How do I assign the AVG- value to a new row in a datagrid. If that's not possible how can I assign it to a label? Thanks for all your help!

  4. #4
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    Well it needs that you have some basic knowledge ADO.NET and various data providers for windows forms in VB.NET. To put it in a nutshell you may add a DATAADAPTER to your form, generate a DATASET and then work with the data in the dataset. Your dataadapter select statment may include that avg function. I strongly recommend you to take a look at MSDN for further information on how to work with databases in .NET

  5. #5

    Thread Starter
    Member
    Join Date
    Dec 2002
    Posts
    54
    I'm familar with ADO.net. I think I can figure it out. Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width