abu taher 34 Practically a Posting Shark

when i want to link a child command with parent command (in data environment) then show this massage. but i make a relation with same field. then why show this massage.
nb: i write sql in command.

Dani AI

Generated

Hi - that message means the Data Environment sees one or more required parameters on the child command that are not actually mapped to a parent field. When you hand-edit SQL the designer may not detect parameters, or a typo/alias can make a column name look like an unmapped parameter. Try this quick checklist and a small runtime workaround.

  • Verify the parent SELECT actually returns the field you want to use (same name/spelling or alias).
  • Open the child command in the Data Environment designer, open its Parameters dialog and make sure every required parameter is present and linked to the appropriate parent field. If a parameter is missing, add it and set its source.
  • If your SQL uses unnamed placeholders (?), note some providers treat parameters positionally. Mapping by name may not work; ensure the parameter order matches the parent field order or use named parameters if the provider supports them.
  • Test the child SQL with a hard-coded value to confirm the SQL itself runs.
  • If the designer still refuses, set the child parameter(s) in code before executing the child command.

Example (VB6 / ADO) - set the parameter from the parent recordset and execute:

Dim cmdChild As ADODB.Command
Set cmdChild = New ADODB.Command
With cmdChild
  .ActiveConnection = cn
  .CommandText = "SELECT * FROM ChildTable WHERE ParentID = ?"
  .CommandType = adCmdText
  Dim p As ADODB.Parameter
  Set p = .CreateParameter("pParentID", adInteger, adParamInput)
  .Parameters.Append p
  .Parameters("pParentID").Value = rsParent!ParentID
  Set rsChild = .Execute
End With

If you post the child SQL, the parent field name and which provider (JET/ODBC/OLE DB) you are using, I can point out the exact mapping problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.