Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / December 2005

Tip: Looking for answers? Try searching our database.

Submitting insert query through data connection not working

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stanley - 07 Dec 2005 16:12 GMT
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
Ben walters - 07 Dec 2005 23:09 GMT
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

> Hi,
>
[quoted text clipped - 25 lines]
>
> Stanley
Stanley - 08 Dec 2005 09:47 GMT
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

> 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
[quoted text clipped - 30 lines]
> >
> > Stanley
Stanley - 12 Dec 2005 15:54 GMT
OK, solved it. This line was missing in my stored procedure:

SET IMPLICIT_TRANSACTIONS off

> Ben,
>
[quoted text clipped - 47 lines]
> > >
> > > Stanley
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.