私は数時間の研究を行いましたが、私の現在の状況には何も適用されないようです。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
コマンドオブジェクトにコマンドテキストを渡すのは、アダプタの責任です。したがって、おそらくあなたのアダプタの 'SelectCommand'が不足しています。 –
@WiktorZychla - データデザイナでTableAdapterプロパティを表示すると、選択、挿入、および更新コマンドがあることが示されます。 – Sirusx69