10 Replies - 1309 Views - Last Post: 15 August 2012 - 02:56 PM Rate Topic: -----

#1 FatBarry   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 13-August 12

Best approach for VB sorting and counting unique values

Posted 13 August 2012 - 02:47 PM

Hi all,

I'm new to vb.net, so please bear with me :)

I'm attempting to create an app to convert a billing spreadsheet into a readable format for our in-house software to read.

I have been able to import the data (using
MyConnection = New System.Data.OleDb.OleDbConnection
) into a datagridview. 2 tasks in the conversion process involve sorting the data by multiple columns (ie : by account number, then invoice number) and counting unique entries (ie : unique invoice numbers)

From what I've read so far, both of these tasks are difficult with datagridviews. Is there a better method to use? If so, could someone give me a brief run down on an approach I could follow for importing from Excel, and the sorting.

Thanks in advance!

Is This A Good Question/Topic? 0
  • +

Replies To: Best approach for VB sorting and counting unique values

#2 _HAWK_   User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1162
  • View blog
  • Posts: 4,444
  • Joined: 02-July 08

Re: Best approach for VB sorting and counting unique values

Posted 13 August 2012 - 04:26 PM

I would use the Entity framework and that would load your database so you could just make sql like lambda queries against it.
Was This Post Helpful? 0
  • +
  • -

#3 FatBarry   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 13-August 12

Re: Best approach for VB sorting and counting unique values

Posted 13 August 2012 - 10:43 PM

View Post_HAWK_, on 13 August 2012 - 04:26 PM, said:

I would use the Entity framework and that would load your database so you could just make sql like lambda queries against it.


Thanks for your reply. Would I be able to do this in VB.net? Also, would I need to use something like SQLite? Can you point me in the right direction for the import importing process. I've done some Googleing and can only finf methods using C#.

Thanks again.
Was This Post Helpful? 0
  • +
  • -

#4 FatBarry   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 13-August 12

Re: Best approach for VB sorting and counting unique values

Posted 14 August 2012 - 12:42 AM

View Post_HAWK_, on 13 August 2012 - 04:26 PM, said:

I would use the Entity framework and that would load your database so you could just make sql like lambda queries against it.

I have done some further searching and have used the code taken from this site :- http://vb.net-inform...xcel_oledb.htm.

Using this approach I can draw the data from Excel using SQL. Is the Entity framework method different from this, and if so, are there any advantages?
Was This Post Helpful? 0
  • +
  • -

#5 _HAWK_   User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1162
  • View blog
  • Posts: 4,444
  • Joined: 02-July 08

Re: Best approach for VB sorting and counting unique values

Posted 14 August 2012 - 09:02 PM

I would recommend SQL Server for the database. The .Net framework does quite well with Entity. There are some special ways to query certain data type with lambda - most notably is the Date functions, but there are easy solutions for them. To make an Entity model it as simple as adding a Datasource to yoyr project and in the wizard you select Etity object and then build from database and your done. Your entire database is available - all tables, procedures, views. And you can make an infinite amount of queries and including sorting after loading the entityContainer. I thought it would be hard to learn, but am so satisfied with doing so I just have to recommend it with great esteem. There are several here who speak lambda so if you give it a try we will help.
Was This Post Helpful? 0
  • +
  • -

#6 FatBarry   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 13-August 12

Re: Best approach for VB sorting and counting unique values

Posted 14 August 2012 - 10:36 PM

Hawk, thanks again for your reply. Unfortunately I'm unable to install SQL Server, as this is being done at work, and I don't have Admin privileges.
The information you've given me has pointed me in the right direction, and at least now I have the data in datatables, which seem more flexible than datagridviews.
Thanks again.
Was This Post Helpful? 0
  • +
  • -

#7 _HAWK_   User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1162
  • View blog
  • Posts: 4,444
  • Joined: 02-July 08

Re: Best approach for VB sorting and counting unique values

Posted 15 August 2012 - 06:10 AM

You can make LINQ queries on datatables as well, storing the info in an object and display them in DGVs or other controls depending on output.
Was This Post Helpful? 0
  • +
  • -

#8 AdamSpeight2008   User is offline

  • MrCupOfT
  • member icon

Reputation: 2298
  • View blog
  • Posts: 9,535
  • Joined: 29-May 08

Re: Best approach for VB sorting and counting unique values

Posted 15 August 2012 - 02:19 PM

Try SQL Server Compact as is doesn't require admin rights.
Was This Post Helpful? 0
  • +
  • -

#9 FatBarry   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 13-August 12

Re: Best approach for VB sorting and counting unique values

Posted 15 August 2012 - 02:24 PM

View PostAdamSpeight2008, on 15 August 2012 - 02:19 PM, said:

Try SQL Server Compact as is doesn't require admin rights.


Adam, thanks for the suggestion. Sorry, I should have been clearer - I can't install anything at all :rolleyes:
Was This Post Helpful? 0
  • +
  • -

#10 AdamSpeight2008   User is offline

  • MrCupOfT
  • member icon

Reputation: 2298
  • View blog
  • Posts: 9,535
  • Joined: 29-May 08

Re: Best approach for VB sorting and counting unique values

Posted 15 August 2012 - 02:53 PM

Not even your application?
Was This Post Helpful? 0
  • +
  • -

#11 FatBarry   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 13-August 12

Re: Best approach for VB sorting and counting unique values

Posted 15 August 2012 - 02:56 PM

View PostAdamSpeight2008, on 15 August 2012 - 02:53 PM, said:

Not even your application?

lol! That's a good question, and a subject that's in discussion. If it's a worthwhile project, running the .exe should be fine.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1