2

I have a legacy system I'm porting from VB 6 to C# and am at the stage where I am grabbing data from the old application's database which is in Access and porting it over to the new database in Sql Server.

Several fields in the access database are string types and contain the contents of a VB 6 PropertyBag. It's basically used like a dictionary in C# with key value pairs. There is the name of a property and then its value which is usually a number or maybe a string.

Anybody have any success in translating VB 6 PropertyBag data?

Thanks.

Mike Malter
  • 1,018
  • 1
  • 14
  • 38

1 Answers1

2

Why not just use a VB6 program to read the old database and write it to the new database? Why bother trying to read the old database in C#? It sounds very difficult.

If you really must write the new database in C#, then write a VB6 COM DLL to read the old database and call it from the C#.

MarkJ
  • 30,070
  • 5
  • 68
  • 111
  • If you do a conversion I suggest that you pick a very generic alternative format. Something like JSON, plain XML, or even delimited text key/value pairs depending on the types of data being stored. – Bob77 Jul 20 '13 at 15:40
  • 1
    @bob77 Since it's apparently going into SQL Server, the best choice is just a separate field for each piece of data! – MarkJ Jul 20 '13 at 16:36
  • I assumed there was some odd reason for bundling a variable set of data into a bag, but in general I tend to agree. – Bob77 Jul 20 '13 at 17:04
  • 1
    MarkJ - thanks for taking the time to answer. This is the approach we're going to take. I learned about how to use com to make the dll a project reference. We are reading the Access database in C# and then are calling a method that will access the VB6 PropertyBag. I have never liked storing property bag type objects whole-hog into a database field for this reason. It my opinion, it is better to break it up and store it in rows in a database. The original programmer said he was not a database guy and it was just easier this way. He is actually the one writing the code we're going to use. – Mike Malter Jul 21 '13 at 01:45