我写了一个工作的VB6应用程序,我现在需要升级到VB.net。 我使用Visual Studio 2008导入(和升级)原始VB6 .vbp,我遇到连接到本地.mdb数据库的问题
对于我在VS2008中使用的最简单的方法,我完全感到困惑,似乎没有什么对我有用。
如果你看看我在VB6中使用的方法,可以在VS2008中使用类似的方法,如果不是最简单的升级过程。
目前我正在尝试写入数据库记录(rsd!Connection = Text7.Text)和
的每行代码“属性'字段'的升级错误是Readonly”“Public ReadOnly默认属性字段的参数太多()为DAO.Fields”的错误 当我尝试阅读(Text3(0).Text = rs!Name)
原始VB6代码的片段在这里
Public daoDB36 As Database
Public rs, rsc, rsd, rse As DAO.Recordset
Set daoDB36 = DBEngine(0).OpenDatabase("c:\program files\2807\2807.mdb")
Set rs = daoDB36.OpenRecordset("System Overview", dbOpenDynaset)
Set rsc = daoDB36.OpenRecordset("Controllers", dbOpenDynaset)
Set rsd = daoDB36.OpenRecordset("References", dbOpenDynaset)
Set rse = daoDB36.OpenRecordset("PWRUnits", dbOpenDynaset)
rse.MoveFirst
For x = 1 To rse.RecordCount
refelectype(x) = rse.Fields(1)
oprat(x) = rse.Fields(2)
contref(x) = rse.Fields(3)
prottrip(x) = rse.Fields(4)
lcd(x) = rse.Fields(5)
dispscroll(x) = rse.Fields(6)
ramp(x) = rse.Fields(7)
For y = 1 To 6
accesscd(x, y) = rse.Fields(7 + y)
Next y
For y = 1 To 6
configcd(x, y) = rse.Fields(13 + y)
Next y
underprot(x) = rse.Fields(20)
overprot(x) = rse.Fields(21)
For y = 1 To 7
fl(x, y) = rse.Fields(21 + y)
Next y
For y = 1 To 4
myip(x, y) = rse.Fields(28 + y)
Next y
For y = 0 To 8
fl(x, y + 8) = rse.Fields(33 + y)
Next y
anodes(x) = rse.Fields(42)
shuntVV(x) = rse.Fields(43)
shuntA(x) = rse.Fields(44)
norefs(x) = rse.Fields(45)
varg(x) = rse.Fields(46)
modde(x) = rse.Fields(47)
demandd(x) = rse.Fields(48)
MonitorPU(x) = rse.Fields(49)
rse.MoveNext
下一个x