2nd Request - Passing parameters to ADO Data Environment command

2nd Request - Passing parameters to ADO Data Environment command

Post by Mike Counci » Fri, 11 Feb 2000 04:00:00



I have set up an insert query with parameters via the Data Environment
designer and despite my best efforts can't seem to find any (concise)
documentation on how to pass data into the parameters on the VB side and
update the DB record.

Command name is MyNewRecord

 INSERT INTO MyTable(Field1, Field2, Field3) VALUES (?, ?, ?)

Parameter names : Param1, Param2, Param3

VB stuff: DataEnvironment1.MyNewRecord()

Where do you go from here?

 
 
 

2nd Request - Passing parameters to ADO Data Environment command

Post by Nea.. » Sat, 12 Feb 2000 04:00:00


You are close, very close..

Did you try something like..
DataEnvironment1.MyNewRecord("Mike", "Council", 1999)

The VB intellisense should have been prompting you as well.

But maybe something else is going on here..



Quote:> I have set up an insert query with parameters via the Data Environment
> designer and despite my best efforts can't seem to find any (concise)
> documentation on how to pass data into the parameters on the VB side
and
> update the DB record.

> Command name is MyNewRecord

>  INSERT INTO MyTable(Field1, Field2, Field3) VALUES (?, ?, ?)

> Parameter names : Param1, Param2, Param3

> VB stuff: DataEnvironment1.MyNewRecord()

> Where do you go from here?

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

2nd Request - Passing parameters to ADO Data Environment command

Post by Mike Counci » Sat, 12 Feb 2000 04:00:00


I can insert (1) parameter and it works fine, but when there are two or more
I get a VB Dialog when the cursor rolls off the line of code;

Compile Error
Expected: =

This works....

DataEnvironment1.MyNewRecord(Variable1)

but this does not...

DataEnvironment1.MyNewRecord(Variable1, Variable2)

Yes, intellisense prompts me.


> You are close, very close..

> Did you try something like..
> DataEnvironment1.MyNewRecord("Mike", "Council", 1999)

> The VB intellisense should have been prompting you as well.

> But maybe something else is going on here..



> > I have set up an insert query with parameters via the Data Environment
> > designer and despite my best efforts can't seem to find any (concise)
> > documentation on how to pass data into the parameters on the VB side
> and
> > update the DB record.

> > Command name is MyNewRecord

> >  INSERT INTO MyTable(Field1, Field2, Field3) VALUES (?, ?, ?)

> > Parameter names : Param1, Param2, Param3

> > VB stuff: DataEnvironment1.MyNewRecord()

> > Where do you go from here?

> Sent via Deja.com http://www.deja.com/
> Before you buy.

 
 
 

2nd Request - Passing parameters to ADO Data Environment command

Post by Nea.. » Sat, 12 Feb 2000 04:00:00


The compile error tells me something else is going on.  Can we see the
exact line that is failing?  Perhaps you are using a reserved word in
some invalid way.



> I can insert (1) parameter and it works fine, but when there are two
or more
> I get a VB Dialog when the cursor rolls off the line of code;

> Compile Error
> Expected: =

> This works....

> DataEnvironment1.MyNewRecord(Variable1)

> but this does not...

> DataEnvironment1.MyNewRecord(Variable1, Variable2)

> Yes, intellisense prompts me.




- Show quoted text -

> > You are close, very close..

> > Did you try something like..
> > DataEnvironment1.MyNewRecord("Mike", "Council", 1999)

> > The VB intellisense should have been prompting you as well.

> > But maybe something else is going on here..



> > > I have set up an insert query with parameters via the Data
Environment
> > > designer and despite my best efforts can't seem to find any
(concise)
> > > documentation on how to pass data into the parameters on the VB
side
> > and
> > > update the DB record.

> > > Command name is MyNewRecord

> > >  INSERT INTO MyTable(Field1, Field2, Field3) VALUES (?, ?, ?)

> > > Parameter names : Param1, Param2, Param3

> > > VB stuff: DataEnvironment1.MyNewRecord()

> > > Where do you go from here?

> > Sent via Deja.com http://www.deja.com/
> > Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.
 
 
 

2nd Request - Passing parameters to ADO Data Environment command

Post by Mike Counci » Sat, 12 Feb 2000 04:00:00


The last line is the one that bombs. I'm sure the variables are formatted
correctly.

'Grab Index number picked by the operator
Merge_Index = DataEnvironment1.rsMergeTable.Fields("Merge_Index").Value
'All other values as entered by operator
Reference_No = CInt(TxtReferenceNo.Text)
DataEnvironment1.testinsert (Merge_Index, Reference_No )
----------------------------------------------------------------------------
---------

I've tried to explicitly enter variables, ie;.....

DataEnvironment1.testinsert ("4", "12345")

and tried without parenthesis. It just doesn't make sense.

The SQL looks like this;.....

INSERT INTO Package(Merge_Index, Reference_No) VALUES (?, ?)

The parameter properties are correct, in the DataEnvironment. I can use
either one, but like I said earlier, when more than one parameter is used...
it bombs.


> The compile error tells me something else is going on.  Can we see the
> exact line that is failing?  Perhaps you are using a reserved word in
> some invalid way.



> > I can insert (1) parameter and it works fine, but when there are two
> or more
> > I get a VB Dialog when the cursor rolls off the line of code;

> > Compile Error
> > Expected: =

> > This works....

> > DataEnvironment1.MyNewRecord(Variable1)

> > but this does not...

> > DataEnvironment1.MyNewRecord(Variable1, Variable2)

> > Yes, intellisense prompts me.



> > > You are close, very close..

> > > Did you try something like..
> > > DataEnvironment1.MyNewRecord("Mike", "Council", 1999)

> > > The VB intellisense should have been prompting you as well.

> > > But maybe something else is going on here..



> > > > I have set up an insert query with parameters via the Data
> Environment
> > > > designer and despite my best efforts can't seem to find any
> (concise)
> > > > documentation on how to pass data into the parameters on the VB
> side
> > > and
> > > > update the DB record.

> > > > Command name is MyNewRecord

> > > >  INSERT INTO MyTable(Field1, Field2, Field3) VALUES (?, ?, ?)

> > > > Parameter names : Param1, Param2, Param3

> > > > VB stuff: DataEnvironment1.MyNewRecord()

> > > > Where do you go from here?

> > > Sent via Deja.com http://www.deja.com/
> > > Before you buy.

> Sent via Deja.com http://www.deja.com/
> Before you buy.

 
 
 

2nd Request - Passing parameters to ADO Data Environment command

Post by Nea.. » Tue, 15 Feb 2000 04:00:00


Hmmm.  Now I'm scratching my head.

Also, in the 'Advanced' tab what is the call syntax?

Could this be your error?
Q226490

http://support.microsoft.com/support/kb/articles/Q226/4/90.ASP?
LNG=ENG&SA=ALLKB&FR=0

-Neal



Quote:> The last line is the one that bombs. I'm sure the variables are
formatted
> correctly.

> 'Grab Index number picked by the operator
> Merge_Index = DataEnvironment1.rsMergeTable.Fields

("Merge_Index").Value
> 'All other values as entered by operator
> Reference_No = CInt(TxtReferenceNo.Text)
> DataEnvironment1.testinsert (Merge_Index, Reference_No )
> ----------------------------------------------------------------------
------
> ---------

> I've tried to explicitly enter variables, ie;.....

> DataEnvironment1.testinsert ("4", "12345")

> and tried without parenthesis. It just doesn't make sense.

> The SQL looks like this;.....

> INSERT INTO Package(Merge_Index, Reference_No) VALUES (?, ?)

> The parameter properties are correct, in the DataEnvironment. I can
use
> either one, but like I said earlier, when more than one parameter is
used...
> it bombs.




- Show quoted text -

> > The compile error tells me something else is going on.  Can we see
the
> > exact line that is failing?  Perhaps you are using a reserved word
in
> > some invalid way.



> > > I can insert (1) parameter and it works fine, but when there are
two
> > or more
> > > I get a VB Dialog when the cursor rolls off the line of code;

> > > Compile Error
> > > Expected: =

> > > This works....

> > > DataEnvironment1.MyNewRecord(Variable1)

> > > but this does not...

> > > DataEnvironment1.MyNewRecord(Variable1, Variable2)

> > > Yes, intellisense prompts me.



> > > > You are close, very close..

> > > > Did you try something like..
> > > > DataEnvironment1.MyNewRecord("Mike", "Council", 1999)

> > > > The VB intellisense should have been prompting you as well.

> > > > But maybe something else is going on here..



> > > > > I have set up an insert query with parameters via the Data
> > Environment
> > > > > designer and despite my best efforts can't seem to find any
> > (concise)
> > > > > documentation on how to pass data into the parameters on the
VB
> > side
> > > > and
> > > > > update the DB record.

> > > > > Command name is MyNewRecord

> > > > >  INSERT INTO MyTable(Field1, Field2, Field3) VALUES (?, ?, ?)

> > > > > Parameter names : Param1, Param2, Param3

> > > > > VB stuff: DataEnvironment1.MyNewRecord()

> > > > > Where do you go from here?

> > > > Sent via Deja.com http://www.deja.com/
> > > > Before you buy.

> > Sent via Deja.com http://www.deja.com/
> > Before you buy.

--
-Neal

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

2nd Request - Passing parameters to ADO Data Environment command

Post by n0.. » Wed, 16 Feb 2000 04:00:00


Try the following

DataEnvironment1.testinsert Merge_Index, Reference_No

For some reason it won't take it with the () surrounding the parameters.

Let us know if this worked for you.



Quote:> The last line is the one that bombs. I'm sure the variables are
formatted
> correctly.

> 'Grab Index number picked by the operator
> Merge_Index = DataEnvironment1.rsMergeTable.Fields

("Merge_Index").Value
> 'All other values as entered by operator
> Reference_No = CInt(TxtReferenceNo.Text)
> DataEnvironment1.testinsert (Merge_Index, Reference_No )
> ----------------------------------------------------------------------
------
> ---------

> I've tried to explicitly enter variables, ie;.....

> DataEnvironment1.testinsert ("4", "12345")

> and tried without parenthesis. It just doesn't make sense.

> The SQL looks like this;.....

> INSERT INTO Package(Merge_Index, Reference_No) VALUES (?, ?)

> The parameter properties are correct, in the DataEnvironment. I can
use
> either one, but like I said earlier, when more than one parameter is
used...
> it bombs.




- Show quoted text -

> > The compile error tells me something else is going on.  Can we see
the
> > exact line that is failing?  Perhaps you are using a reserved word
in
> > some invalid way.



> > > I can insert (1) parameter and it works fine, but when there are
two
> > or more
> > > I get a VB Dialog when the cursor rolls off the line of code;

> > > Compile Error
> > > Expected: =

> > > This works....

> > > DataEnvironment1.MyNewRecord(Variable1)

> > > but this does not...

> > > DataEnvironment1.MyNewRecord(Variable1, Variable2)

> > > Yes, intellisense prompts me.



> > > > You are close, very close..

> > > > Did you try something like..
> > > > DataEnvironment1.MyNewRecord("Mike", "Council", 1999)

> > > > The VB intellisense should have been prompting you as well.

> > > > But maybe something else is going on here..



> > > > > I have set up an insert query with parameters via the Data
> > Environment
> > > > > designer and despite my best efforts can't seem to find any
> > (concise)
> > > > > documentation on how to pass data into the parameters on the
VB
> > side
> > > > and
> > > > > update the DB record.

> > > > > Command name is MyNewRecord

> > > > >  INSERT INTO MyTable(Field1, Field2, Field3) VALUES (?, ?, ?)

> > > > > Parameter names : Param1, Param2, Param3

> > > > > VB stuff: DataEnvironment1.MyNewRecord()

> > > > > Where do you go from here?

> > > > Sent via Deja.com http://www.deja.com/
> > > > Before you buy.

> > Sent via Deja.com http://www.deja.com/
> > Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.
 
 
 

2nd Request - Passing parameters to ADO Data Environment command

Post by Michael Forste » Fri, 18 Feb 2000 04:00:00


I am not that used to ADO and use DAO3.5 and the equivelant command in DAO
is as follows

DBmain.Execute "INSERT INTO Package( Merge_Index,Reference_No)
VALUES_(12345,12345) From TestTable

You can leave out the Values and it will just copy the entries from the
original table

have you tried leaving out the VALUES clause ?

Mike.

>> The SQL looks like this;.....

>> INSERT INTO Package(Merge_Index, Reference_No) VALUES (?, ?)

>> The parameter properties are correct, in the DataEnvironment. I can
>use
>> either one, but like I said earlier, when more than one parameter is
>used...
>> it bombs.



>> > The compile error tells me something else is going on.  Can we see
>the
>> > exact line that is failing?  Perhaps you are using a reserved word
>in
>> > some invalid way.



>> > > I can insert (1) parameter and it works fine, but when there are
>two
>> > or more
>> > > I get a VB Dialog when the cursor rolls off the line of code;

>> > > Compile Error
>> > > Expected: =

>> > > This works....

>> > > DataEnvironment1.MyNewRecord(Variable1)

>> > > but this does not...

>> > > DataEnvironment1.MyNewRecord(Variable1, Variable2)

>> > > Yes, intellisense prompts me.



>> > > > You are close, very close..

>> > > > Did you try something like..
>> > > > DataEnvironment1.MyNewRecord("Mike", "Council", 1999)

>> > > > The VB intellisense should have been prompting you as well.

>> > > > But maybe something else is going on here..



>> > > > > I have set up an insert query with parameters via the Data
>> > Environment
>> > > > > designer and despite my best efforts can't seem to find any
>> > (concise)
>> > > > > documentation on how to pass data into the parameters on the
>VB
>> > side
>> > > > and
>> > > > > update the DB record.

>> > > > > Command name is MyNewRecord

>> > > > >  INSERT INTO MyTable(Field1, Field2, Field3) VALUES (?, ?, ?)

>> > > > > Parameter names : Param1, Param2, Param3

>> > > > > VB stuff: DataEnvironment1.MyNewRecord()

>> > > > > Where do you go from here?

>> > > > Sent via Deja.com http://www.deja.com/
>> > > > Before you buy.

>> > Sent via Deja.com http://www.deja.com/
>> > Before you buy.

>Sent via Deja.com http://www.deja.com/
>Before you buy.

 
 
 

1. Data Environment and passing parameters to child commands

I have a question regarding parameters to child commands in the
DataEnvironment. I will try to explain the problem with a simple
example.
Example:
  Parent-
    Table:PetOwner
      ID
      Name
      Adress
  Child-
    Table:Pet
      ID
      Name
      Gender
      Age

The relation is ID = ID ofcourse.
I would like to use the same report to show:
  1) PetOwner and his/hers pets with an age < 2 (Or with an age <
parameter)
  2) PetOwner and his/hers pets with name = 'Peter'
  3) PetOwner and his/hers pets with Gender = male

1) Is it possible to have some variables/parameters for this or do I
have to do three different reports?
    (This wont solve the problem with the parameter in report #1)

   I know how to use parameters in the 'parent' command. My problem is
that I would like to pass the parameters to the child command.
   In this way I would be able to use the same commands & report to
make different reports depending on the parameters.

   The obvious solution is to make more commands and reports. (They
will be almost identical. But I will not be able to make 'dynamic'
querys like I want.) This is something that I would like to avoid.

2) I could manage to do what I want if I could change the CommandText
of the child command. (CommandText~=SQL command)
   I know how to set the CommandText of the 'parent', but I cannot do
it for the child command.

   This is how I do it for the 'parent' command:
     DataEnv.Commands("cmdPetOwner").CommandText = "SELECT * FROM
PetOwner"

   Is there anyone that knows how to find and change the child
CommandText and parent relations?

3) I could add a new table that contains the parameters.
   I would have to insert the parameters into this new table prior to
running the command/report.
   The command would have to look at this table to get the parameters.
   I would like to avoid this if it's possible.

Is there anyone that has had the same problem? And maybe a/the
solution?

2. US-Informix, Client/Server, Unix, C - Top $$$

3. How to pass multi parameters in ado command parameter

4. training

5. Showing parameters pass to data environment in data report header

6. Job...WA; Oracle DBA Manager; Web, 8.x, 7/24 Production, PL/SQL

7. Pro*C connection problem

8. host data type in data environment command parameters

9. How to pass a variable into a SQL Statement Command is Data Environment

10. Passing Arguments in Commands of Data Environments

11. Passing NULL values through Data Environment Command

12. Problem with parameter passing with data environment