Retrieve Data in Customization from ERP Database

It is a basic question, but at the Moment i am unable to solve it… I am currently implementing additional fields to assign a contact to serialnumbers. All fine, but now I want look into the database du find the Name of a Contact with the PerConID from epiTextBoxC1.
Is there something like:
string name = Db.PerCon.Where(… == c1.Text).Select… ??
select name from erp.percon where…

I don’t want to update or anything.

Use a BAQ. You can’t access the DB object on the front end… nor do you want to.

Your other option aside from a BAQ (which is the easiest way) is to use the proper BO Adapters

Using a BAQ works great. Thank you :slight_smile:

Here my code:

	if(e10 would know this is code i would not have to do this ){
// ** Place Event Handling Code Here **
DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("serno_contact");
qeds.ExecutionParameter.AddExecutionParameterRow("ParPerConID", txtPerConID_c.Text, 	"int", false, Guid.NewGuid(), "A");
dqa.ExecuteByID("serno_contact", qeds);
	if(dqa.QueryResults.Tables["Results"].Rows.Count == 0){
		MessageBox.Show("Unable to find Contact");
		txtPerConID_c.Text = "0";
		txtName_c.Text = ""; 
	foreach(DataRow row in dqa.QueryResults.Tables["Results"].Rows){
		if(txtName_c.Text != row["PerCon_Name"].ToString()){
			MessageBox.Show("ContactID does no fit to the Contact name. Updating Contact name now! ");
			EpiDataView edvSerialNo = ((EpiDataView)(this.oTrans.EpiDataViews["SerialNo"]));
			System.Data.DataRow edvSerialNoRow = edvSerialNo.CurrentDataRow;
			if ((edvSerialNoRow != null)){
				edvSerialNoRow["Name_c"] = row["PerCon_Name"];