You can take advantage of code generated by TCDesigner easily using WinForms.
This model is the “client-server” 2-tier model. In this model, the data access
tier is called directly. A middle tier is optional. In addition to the sample
code below, a complete WinForms project can be found in the samples folder
where TCDesigner is installed.
This example assumes you have a WinForm for updating a record from the Customers
table. On that form is a text box for each field in the table and a Save
button. This is sample code only. You should always implement error handling in
your production code.
Click here to download a sample WinForms project.
In Your WinForm:
private void cmdSave_Click(object sender, System.EventArgs e)
{
BaseDAConn objConn = null;
DBCustomersRow objRow;
DACustomers objDB;
// Create a new Customers row (generated) to be saved
objRow = new DBCustomersRow();
// Fill in the Row to be saved
objRow.CustomerID = Convert.ToString ( txtCustomerID.Text );
objRow.CompanyName = Convert.ToString ( txtCompanyName.Text
);
objRow.ContactName = Convert.ToString ( txtContactName.Text
);
objRow.ContactTitle = Convert.ToString (
txtContactTitle.Text );
objRow.Address = Convert.ToString ( txtAddress.Text );
objRow.City = Convert.ToString ( txtCity.Text );
objRow.Region = Convert.ToString ( txtRegion.Text );
objRow.PostalCode = Convert.ToString ( txtPostalCode.Text );
objRow.Country = Convert.ToString ( txtCountry.Text );
objRow.Phone = Convert.ToString ( txtPhone.Text );
objRow.Fax = Convert.ToString ( txtFax.Text );
// Create a database object (generated)
objDB = new DACustomers();
// Open the DB (generated)
objConn = new BaseDAConn( AppStatic.Global.DefaultDASettings
);
// Call the save methoed (generated)
bool bRet = objDB.SaveRow( objConn, objRow ) )
}