Hi all
i have question again, this is my code:
private void btAdd_Click(object sender, EventArgs e)
{
SqlDataAdapter adapter = new SqlDataAdapter();
DataSet ds = new DataSet();
DataView dv;
string sql = null;
string connetionString = "Data Source=GOD_LOVE_ME;Initial Catalog=ProjetDB;Integrated Security=True";
sql = "Select * from Material";
SqlConnection connection = new SqlConnection(connetionString);
try
{
connection.Open();
SqlCommand command = new SqlCommand(sql, connection);
adapter.SelectCommand = command;
adapter.Fill(ds, "Add New");
adapter.Dispose();
command.Dispose();
connection.Close();
dv = new DataView(ds.Tables[0]);
DataRowView newRow = dv.AddNew();
newRow["MaterialID"] = txKode.Text;
newRow["MaterialName"] = txNama.Text;
newRow["MatGroupID"] = cbGroup.Text;
newRow.EndEdit();
dv.Sort = "MaterialID";
DG1.DataSource = dv;
}
catch (Exception ex)
{
MessageBox.Show (ex.ToString());
}
this code for add row but my problem is how making row in last table, because my code only add in second row.
best regards,
martin