public void SetCustomerAndVendorInformation(string number, string tableType) { if (number != "" && tableType != "") { DataSet dslist = new DataSet(); DataTable dtlist = new DataTable(); string tableName = ""; string columnValue = ""; string where = ""; if (tableType.Trim().ToLower() == "cust") { tableName = "CustomerAddress RIGHT OUTER JOIN CustomerMaster ON CustomerAddress.fCustomerMasterID = CustomerMaster.pCustMstrID"; columnValue = "CustomerAddress.fCustomerMasterID, CustomerAddress.Type, CustomerAddress.AddrLine1, dbo.CustomerAddress.City,CustomerAddress.State, CustomerAddress.PostCd, CustomerAddress.Country, CustomerAddress.PhoneNo, CustomerAddress.Email,CustomerAddress.EntryID,CustomerAddress.EntryDt, CustomerAddress.ChangeID,CustomerAddress.ChangeDt, CustomerMaster.pCustMstrID, CustomerMaster.CustNo, CustomerMaster.CustName"; where = "CustNo='" + number + "'"; } else { tableName = "VendorAddress RIGHT OUTER JOIN VendorMaster ON VendorAddress.fVendMstrID = VendorMaster.pVendMstrID"; columnValue = " VendorAddress.Type, VendorAddress.fVendMstrID, VendorAddress.Line1 as AddrLine1 , dbo.VendorAddress.State, VendorAddress.City,VendorAddress.PostCd, VendorAddress.Country, VendorAddress.PhoneNo, VendorAddress.Email, VendorAddress.EntryID,VendorAddress.EntryDt, VendorAddress.ChangeID, VendorAddress.ChangeDt, VendorMaster.pVendMstrID, VendorMaster.VendNo as custno,VendorMaster.Name as CustName"; where = "vendNo='" + number + "'"; } dslist = SqlHelper.ExecuteDataset(connectionString, "pSOESelect", new SqlParameter("@tableName", tableName), new SqlParameter("@columnNames", columnValue), new SqlParameter("@whereClause", where)); dtlist = dslist.Tables[0]; if (dtlist.Rows.Count > 0) { lbltype.Text = "Type: " + number; lblName.Text = dtlist.Rows[0]["CustName"].ToString().Trim(); lblAddress.Text = dtlist.Rows[0]["AddrLine1"].ToString().Trim(); lblCityInfo.Text = dtlist.Rows[0]["City"].ToString().Trim() + ", " + dtlist.Rows[0]["State"].ToString().Trim() + " " + dtlist.Rows[0]["PostCd"].ToString().Trim(); lblPhone.Text = "Phone: " + utility.FormatPhoneNumber(dtlist.Rows[0]["PhoneNo"].ToString().Trim());; lblCountry.Text = dtlist.Rows[0]["Country"].ToString().Trim(); tblOrgStdCOmments.Visible = true; btnAdd.Visible = true; tblDataEntry.Visible = false; btnSave.Visible = false; btnCancel.Visible = false; } else { lbltype.Text = ""; lblName.Text = ""; lblAddress.Text = ""; lblCityInfo.Text = ""; lblCountry.Text = ""; lblPhone.Text = ""; tblOrgStdCOmments.Visible = false; tblDataEntry.Visible = false; btnAdd.Visible = false; } } }