다음과 같은 문제가 있습니다. gridView에서 값이 변경되면 데이터베이스를 업데이트하는 데 사용할 데이터 집합이 있습니다. 데이터 집합은 다음의 방법에서 온다 :winform 응용 프로그램에서 DataSet 업데이트
public static DataSet Display_all_members()
{
ds = new DataSet();
try
{
string query = "SELECT date_to, last_name ,first_name , member_pay FROM Member ";
conS.Open();
adapter = new SqlDataAdapter(query, conS);
adapter.Fill(ds, "To_display");
}
catch (Exception r)
{}
finally
{
conS.Close();
}
return ds;
}
내가 업데이트 할 수 지금
ds2 = DAL.Display_all_members();
dataGridView1.DataSource = ds2;
dataGridView1.DataMember = "To_display";
을 형태와 나는 방법에서 양식
if (ds2.HasChanges() == true)
{
DAL.update(ds2);
}
에서 다음을 수행
public static void update(DataSet ki)
{
SqlCommandBuilder n = new SqlCommandBuilder(da);
da.Update(ds);
}
그리고 작동하지 않습니다. 뭐가 문제 야? 이것은 오류입니다 : TableMapping [ 'Table'] 또는 DataTable 'Table'을 (를) 찾을 수 없습니다.
1) CommandBuilder를 실제로 사용하지 않습니다. 2) 기본 키가 포함되어 있지 않습니다. 3) "To_display"를 업데이트에 전달해야 할 수도 있습니다. –
당신은 내 질문을 업데이트 할 수 있습니다. 감사합니다. –
데이터 세트를 채우는 데 사용중인 실제 SQL을 게시 할 수 있습니까? – Raghu