我已经做了几个小时的研究,但似乎没有什么适用于我目前的情况。ExecuteReader:CommandText属性尚未初始化
使用:Visual Studio 2010的.NET 4.0 语言:C#
问题:
我创建了一个表格,然后将它从我的数据源下降的特定表到形式有VS2010创建数据我的桌子。 当我尝试使用数据表更改或向数据库添加值时,出现上面列出的错误“ExecuteReader:CommandText属性尚未初始化”。
从我以前的研究,不,我没有定义CommandText,也不知道在哪里创建一个考虑VS2010创建所有数据表的代码,并没有列出.cs文件本身。
感谢您的帮助!
代码从形式击中F7
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace mineral_monitor.Manual_edits
{
public partial class mineral_stock : Form
{
public mineral_stock()
{
InitializeComponent();
}
private void mineralsBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.mineralsBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.ore_stockDataSet1);
}
private void mineral_stock_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'ore_stockDataSet1.minerals' table. You can move, or remove it, as needed.
this.mineralsTableAdapter.Fill(this.ore_stockDataSet1.minerals);
}
}
}
此获得的是通过在数据设计手动创建一个更新串解决。
CommandText = ????请发布您的代码.. CommandType = ??? – MethodMan 2012-02-14 15:09:09
将命令文本传递给命令对象是适配器的责任。因此,您可能无法使用适配器中的“SelectCommand”。 – 2012-02-14 15:49:16
@WiktorZychla - 当我在数据设计器中查看TableAdapter属性时,它确实声明它具有选择,插入和更新命令。 – Sirusx69 2012-02-14 15:52:21