0

I am new to SQL; I have a VB.net project that works fine with Microsoft SQL Server Compact v3.5 (and OleDB) on Windows 7, and I want to compile it on Windows 10 with Visual Studio 2019.

When I tried to compile it on Windows 10, I get a lot of errors:

Null reference exception

in debug mode, and it freezes in release mode in the first window (sorry I can't add a code example because the project is too big).

I have seen that Microsoft SQL Server Compact v3.5 doesn't support Windows 10 (I'm not sure about this information) in this link : https://www.microsoft.com/en-us/download/details.aspx?id=5783

If it is true how can I make my project work in Windows 10? And thank you.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
all.west
  • 71
  • 1
  • 1
  • 11
  • 2
    SQL Server Compact is deprecated, and only has support until July of this year; why are you using it for a project in the first place? – Thom A Jan 17 '21 at 13:20
  • 1
    Does this answer your question? [What is a NullReferenceException, and how do I fix it?](https://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it) – Charlieface Jan 17 '21 at 13:25
  • @Larnu Because it is an old code programmed with sql server compact 3.5, and it works fine with Windows 7 but not Windows 10 – all.west Jan 17 '21 at 13:30
  • 1
    [SQL Server editions](https://www.microsoft.com/en-us/sql-server/sql-server-downloads). Two free downloads available + one on-line. The Compact edition is not a viable option. – Jimi Jan 17 '21 at 13:31
  • @Jimi I do not know very well how the DB works, could you elaborate on your answer please ? All I know is that my DB composed of (.sdf) files inside my project, are there any conversions to be made to go from SQL server compact 3.5 to SQL Server? – all.west Jan 17 '21 at 13:43
  • You can replace your Compact edition with SQL Server Express / LocalDb. Or, if you need a simpler embedded solution, go for SQLite. For conversions, see [EricEJ](https://stackoverflow.com/users/183934/erikej)'s [SQLite & SQL Server Compact Toolbox](https://github.com/ErikEJ/SqlCeToolbox) – Jimi Jan 17 '21 at 14:10
  • My code uses (OLEDB or SQLCE) so I think I can use OLEDB instead of SQLCE. But I can't find much information about OLEDB on the internet. Can someone please tell me does it work with Windows 10 or not ? – all.west Jan 17 '21 at 15:18
  • You think you can use OleDb with which database? OleDb is a high-level interface that provides standardized method to access data using different data providers. You have to decide what data provider you'll be using. It depends on what your database is used for. If it's just to store data for the internal functionality of your app, see SQLite, if you have a multi-user environment, then SQL Server Express (or one of the many multi-user database Servers available). SQL Server Compact has been discontinued. – Jimi Jan 17 '21 at 16:19
  • @Jimi Yes you are right my code uses SQLCE and OLEDB and not one of the two. I don't know how to start I know nothing about SQL server (and a little about SQLCE), do you think transforming a VB.net code from SQLCE to SQL server will be easy? Also for .sdf files I have to create new . mdf files to replace them? – all.west Jan 17 '21 at 17:16
  • As mentioned, OleDb uses a common interface: all method are exactly the same (except, of course the SQL syntax, but that's not related to OleDb itself); with SQL Server, you have `SqlClient`, so you use, e.g., `SqlCommand` instead of `OleDbCommand`, but with the exact same syntax. -- You need to convert the `.sdf` files to the `.mdf` format. That's why I linked the ErikEJ's Toolkit. – Jimi Jan 17 '21 at 17:22
  • @Jimi Thank you very much for your help, last question do you think I will have any problem with .NET because the software was developed in 2010 with the version 4.0 of .net, and now I am using .Net 4.8 in Visual Studio 2019. – all.west Jan 17 '21 at 18:08
  • 1
    Only with stuff that got marked as `[Obsolete]` in the meanwhile. .Net Framework is otherwise backwards-compatible. You'll find something (usually another method overload / another property / class) that replaces it. – Jimi Jan 17 '21 at 18:14

0 Answers0