开发者

VB.NET - This piece of code will run in VS2010 but not in VS2008 - why?

I coded this thing up in VS2010, it worked fine. I needed to port it to VS2008, which went smoothly, aside from fixing how a few lines were worded. But it won't run, and my error codes say it's in opening this database.

com = New OleDbConnection(DB_Path)
com.Open()

With a string at the top defining DB_Path

Public Const DB_Path As String = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=.\ASPNetDB.mdb"

Those two lines of code at the only thing in a Try statement, so they're the only thing that could be going wro开发者_运维百科ng here. And yes, I made sure to copy the database into the new directory. I even tried using the full direct path in there and that didn't work either.

So what have I missed?


On a 64bit machine in VS2008 you need to set the target CPU to 32bit in the project properties, no 64 bit DLL exist for database access. I hope this helps


Just a guess-- but you may have to use a different Jet provider (not 4.0) in VS 2008, since it will be targeting an earlier release of .Net.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜