主题:DataApapter 不能更新数据,向高手求救!!!
DataAdapter_LB.SelectCommand = New SqlCommand()
DataAdapter_LB.SelectCommand.Connection = connectionString()
DataAdapter_LB.SelectCommand.CommandText = "select distinct lbIDDD,LBNAME from lb"
DataAdapter_LB.SelectCommand.CommandType = CommandType.Text
DataSet_LB.Clear()
DataAdapter_LB.Fill(DataSet_LB, "LB")
DataGridView_LB.DataSource = DataSet_LB
DataGridView_LB.DataMember = "LB"
Dim myCBuilder As New SqlCommandBuilder(DataAdapter_LB) DataAdapter_LB.UpdateCommand = myCBuilder.GetUpdateCommand
DataAdapter_LB.Update(DataSet_LB, "LB")
总是报错:对于不返回任何键列信息的 SelectCommand,不支持 UpdateCommand 的动态 SQL 生成
DataAdapter_LB.SelectCommand.Connection = connectionString()
DataAdapter_LB.SelectCommand.CommandText = "select distinct lbIDDD,LBNAME from lb"
DataAdapter_LB.SelectCommand.CommandType = CommandType.Text
DataSet_LB.Clear()
DataAdapter_LB.Fill(DataSet_LB, "LB")
DataGridView_LB.DataSource = DataSet_LB
DataGridView_LB.DataMember = "LB"
Dim myCBuilder As New SqlCommandBuilder(DataAdapter_LB) DataAdapter_LB.UpdateCommand = myCBuilder.GetUpdateCommand
DataAdapter_LB.Update(DataSet_LB, "LB")
总是报错:对于不返回任何键列信息的 SelectCommand,不支持 UpdateCommand 的动态 SQL 生成