Database Reference
In-Depth Information
txtDepartment.AppendText("\n");
}
// Create command
SqlCommand cmd = new SqlCommand(ins, conn);
//
// Map parameters
cmd.Parameters.Add("@Name", SqlDbType.NVarChar, 50,"Name");
cmd.Parameters.Add("@GroupName",SqlDbType.NVarChar,50,"GroupName");
cmd.Parameters.Add("@ModifiedDate",SqlDbType.DateTime,25,"ModifiedDate");
// Insert department
da.InsertCommand = cmd;
da.Update(ds, "HumanResources.Department");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + ex.StackTrace);
}
finally
{
//Connection close
conn.Close();
}
}
6. To set the PersistAdds form as the start-up form, modify the Program.cs
statement.
Application.Run(new ModifyDataTable());
to appear as:
Application.Run(new PersistAdds());
Build the project, and run it by pressing Ctrl+F5. You should see the results in
Figure 15-12.
Figure 15-12. Adding a row
 
Search WWH ::




Custom Search