2
Reply

Migrating from VB to C# and database not working

Will

Will

Apr 11 2009 12:48 PM
2.7k
I've got a real complicated (for me, anyway) problem.

I have an Access database on my current site. I have results pages that are .aspx pages with VB code. Everything works fine.

But the site is being upgraded, and with the new .aspx pages the default page code is C#, not VB. On our development site (same machine, different directory, and from what I can see in the site settings the same database connections are present and valid in that development directory) I have copied over the "fpdb" folder and the database as well as the _fpclass folder (I had to rename the folder without the "_" but my .aspx page seems to be finding the folder and its files just fine). Of course, I have "fpdblib.inc", "fpdbrgn1.inc" and "fpdgrgn2.inc" as includes on my results .aspx page just like on the original site, but since they are in VB, my new C# .aspx page is throwing errors. So I tried using "<script type="text/VB"></script> tags around the code of the 3 files instead of the default "<% %>", and the errors stop, but I get no results from my database when a query is passed (though when I view the source I can see the code has been included), and when I use the runat="server" directive I get errors again (I assume it's not supposed to run at the server though?). I even tried converting the 3 .inc files to C# with the help of an online converter and I still got errors. And also, on the .aspx results page itself, there is additional "<% %>" code for the field values in the database results region that I think I need to convert as well.

I'm at a loss of what I should do. If there are working C# versions of the .inc files out there that might be exactly what I need, as well as knowing what code to use for the field values of the database results region as mentioned. The only other thing I can think of is doing without the FP database code and using just all SQL and whatever else I need to handle the results page (whatever the .inc files are doing), but that's all going to be new to me and I'm under pressure as it is with migrating the rest of the Web site. I was hoping eventually to work on migrating the databases from Access to SQL/MYSQL or whatever, but I wanted time to do it right and now is just the worst time...

Anyone have any insight or answers they can share with me? The best solution for me (and my sanity) at the moment would be to find a way to keep what I have and just make it work with the new C# pages (which are full of other features that are all C#, so reverting to VB as the default code is not an option).

Thanks...

Answers (2)