Submitting insert query through data connection not working

S

Stanley

Hi,

i have a an infopath form in which i create an insert query in code and than
execute the query through infopath dataconnection. My code looks like this:

//Execute all queries
ADOAdapterObject adaptRates =
(ADOAdapterObject)doc.DataObjects["Rates"].QueryAdapter;
string strSQLOriginalRates = adaptRates.Command.ToString();
IEnumerator myEnumerator = QueryArray.GetEnumerator();
while ( myEnumerator.MoveNext() )
{
adaptRates.Command = myEnumerator.Current.ToString();
adaptRates.Query();
}
//Set original query back
adaptRates.Command = strSQLOriginalRates;
adaptRates.Query();


I have created an array which contains several insert statements to execute.
I have a development environment where it works. I have created another dev
environment on another machine. But somehow the insert query does not
executes. But the "adaptRates.Query();" command executes just fine.I use the
same user rights for the sql database. What am i overlooking here or is there
something else wrong?

Thnx,

Stanley
 
B

Ben walters

Is it possilbe that your not pointing at the right database? I know when you
move forms from one machine to another the Dataconnections are not
automatically updated. Try giong through and recreating your dataconnections
making sure the map to the DB on your new dev environment
 
S

Stanley

Ben,

i already did that. To make sure i did, i changed some settings and data on
the new env to reflect when i open the form so that i am sure i am connecting
to the correct database. And to be more sure i check both databases to see if
the records have been added. Both database don't have the new records when i
submit the data.

I made a connection to the new database with a sql user and connected to the
"Rates" table. In code (first line of my code) i use this connection to run
the query which is a stored procedure (does an insert).The sql user has
execute rights on this stored procedure.

I'm lost.

STanley

Ben walters said:
Is it possilbe that your not pointing at the right database? I know when you
move forms from one machine to another the Dataconnections are not
automatically updated. Try giong through and recreating your dataconnections
making sure the map to the DB on your new dev environment

Stanley said:
Hi,

i have a an infopath form in which i create an insert query in code and than
execute the query through infopath dataconnection. My code looks like this:

//Execute all queries
ADOAdapterObject adaptRates =
(ADOAdapterObject)doc.DataObjects["Rates"].QueryAdapter;
string strSQLOriginalRates = adaptRates.Command.ToString();
IEnumerator myEnumerator = QueryArray.GetEnumerator();
while ( myEnumerator.MoveNext() )
{
adaptRates.Command = myEnumerator.Current.ToString();
adaptRates.Query();
}
//Set original query back
adaptRates.Command = strSQLOriginalRates;
adaptRates.Query();


I have created an array which contains several insert statements to execute.
I have a development environment where it works. I have created another dev
environment on another machine. But somehow the insert query does not
executes. But the "adaptRates.Query();" command executes just fine.I use the
same user rights for the sql database. What am i overlooking here or is there
something else wrong?

Thnx,

Stanley
 
S

Stanley

OK, solved it. This line was missing in my stored procedure:

SET IMPLICIT_TRANSACTIONS off


Stanley said:
Ben,

i already did that. To make sure i did, i changed some settings and data on
the new env to reflect when i open the form so that i am sure i am connecting
to the correct database. And to be more sure i check both databases to see if
the records have been added. Both database don't have the new records when i
submit the data.

I made a connection to the new database with a sql user and connected to the
"Rates" table. In code (first line of my code) i use this connection to run
the query which is a stored procedure (does an insert).The sql user has
execute rights on this stored procedure.

I'm lost.

STanley

Ben walters said:
Is it possilbe that your not pointing at the right database? I know when you
move forms from one machine to another the Dataconnections are not
automatically updated. Try giong through and recreating your dataconnections
making sure the map to the DB on your new dev environment

Stanley said:
Hi,

i have a an infopath form in which i create an insert query in code and than
execute the query through infopath dataconnection. My code looks like this:

//Execute all queries
ADOAdapterObject adaptRates =
(ADOAdapterObject)doc.DataObjects["Rates"].QueryAdapter;
string strSQLOriginalRates = adaptRates.Command.ToString();
IEnumerator myEnumerator = QueryArray.GetEnumerator();
while ( myEnumerator.MoveNext() )
{
adaptRates.Command = myEnumerator.Current.ToString();
adaptRates.Query();
}
//Set original query back
adaptRates.Command = strSQLOriginalRates;
adaptRates.Query();


I have created an array which contains several insert statements to execute.
I have a development environment where it works. I have created another dev
environment on another machine. But somehow the insert query does not
executes. But the "adaptRates.Query();" command executes just fine.I use the
same user rights for the sql database. What am i overlooking here or is there
something else wrong?

Thnx,

Stanley
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top