Fill:SelectCommand.Connection property has not been initialized Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand Connection.ConnectionString = Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|/homeautosys.mdb Connection.Open() DataTab_LightOff.Clear() Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter dataAdapter.SelectCommand = dbCommand Dim DataAdapter_LighOff As System.Data.DataSet = New System.Data.DataSet command_LightOff = update [Lights] set [Off_On]= Off Where ( [Lights].[Room_Name]= Bedroom One ) DataAdapter_LightOff = New Data.OleDb.OleDbDataAdapter(command_LightOff,Connection) dataAdapter.Fill(DataTab_LightOff) 这是源
代码,编译的时候出现
错误:Fill:SelectCommand.Connection property has not been initialized 这是什么原因?该怎么改? 是在移动
页面上做的 目的是实现点COMMAND的控件,然后
数据库中中BEDROOM ONE的那行的OFF_ON列对应的值变为OFF 如果上面的
方法不对,最完写完整的另外的
代码! __________________________________________________________________________ dbCommand.CommandText = select *.... ; 需要指定。 __________________________________________________________________________ Connection.ConnectionString = Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|/homeautosys.mdb Connection.Open() Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand( update [Lights] set [Off_On]= Off Where ( [Lights].[Room_Name]= Bedroom One ) ) dbCommand.Connection=Connection dbCommand.ExecuteNonQuery __________________________________________________________________________
原文链接:https://www.f2er.com/vb/263419.html