Search EggHeadCafe's Job Board
EggHeadCafe Silverlight WPF ASP.NET VB.NET C# Excel SQL Server SharePoint
search
Miscellaneous GroupsView
Adsi General
Axapta
Greatplains
Helpauthoring
Hiserver General
Infopath
Mac Office
Mac Office Entourage
Mac Office Word
Mac Otherproducts
Mac Rdc
Mac Virtualpc
Macintosh General
Mom
Mshardware Product
Windows File_System
Windows Group_Policy
Windows Msi
Windows Tabletpc
Pos
Servicesforunix General
Simulators
Smartphone
Softwareupdatesvcs
Solomon
Windbg
Windows Terminal_Services
Dataprotectionmanager
Axapta Application
Axapta Programming
Windows Sharedaccess
Fortran
Groove
Msroboticsstudio
Deployment Desktop
Design Gallery
Developer Outlook Addins
Development Device Drivers
Windows Devices Pnpx
.NET Micro
Dynamics Gp Developer
Security Forefront
Internetexplorer Beta
Sv Windows
Development Device Drivers Dtm
Hyper-V
Internetexplorer

Group SummariesView
.NET Framework
Access
BizTalk
Certifications
CRM
DDK
Exchange Server
FoxPro
French
French .NET
Games
German
German .NET
Graphic Design
IIS
Internet
ISA Server
Italian
Italian .NET
Maps
MCIS
Miscellaneous
Mobile Apps
Money
MSN
Networking
Office
Ops Mgr
Publisher
Security
SharePoint
Small Business
Spanish
Spanish .NET
SQL Server
Systems Management Server
Transaction Server
Virtual PC / Virtual Server
Visual Studio
Win32
Windows 2000
Windows 2003 Server
Windows 7
Windows Live
Windows Media
Windows Update
Windows Vista
Windows XP
 

View All Microsoft Infopath Posts  Ask A New Question 

Secondary data connection gets queried twice

aldo posted on Wednesday, November 14, 2007 8:26 PM

I am currently developing a Purchase Order form using InfoPath that is
publishing to a MOSS2007 forms library. (using Infopath 2003 currently)

The issue I am having is with generating unique, incremental PO numbers
automatically when a new form is created (ideally when the form is opened,
not when submitted). Having browsed around a lot I have determined that many
others have the same problem. The solution that I was hoping to use is to
have a SQL stored procedure that basically adds a row to a table that has an
identity column and then retrieve the SCOPE_IDENTITY() to return the PO
Number. This works well except for one annoying fact. For some reason, the
connection is always queried twice. This, of course, results in the PO Number
incrementing by 2 each time which is a bit annoying. I have tried both
programmatically running the query when the form opens (OnLoad) and also just
using the checkbox in the Data Connection configuration, but both have the
same effect.

I have run a SQL trace and can see the sp being called twice. The first time
it is sandwiched by a SET IMPLICIT_TRANS ON... ROLLBACK TRANS which I assume
is being added by InfoPath. Has anyone else run into this? Any other
solutions available for creating a simple identity field in a form?

Thanks,

Dana
reply

 

The call with ROLLBACK TRANS is being used by InfoPath to get the schema of

Bryan Phillips posted on Saturday, November 17, 2007 12:03 PM

The call with ROLLBACK TRANS is being used by InfoPath to get the schema
of the resultset without returning any data.  Unfortunately, that
rollback does not rollback the identity value too for performance
reasons.

--
Bryan Phillips
MCT, MCSD, MCDBA, MCSE
Microsoft MVP - Client Application Development
Blog:  http://bphillips76.spaces.live.com
Web Site:  http://www.composablesystems.net
reply

Thanks Bryan.

aldo posted on Saturday, November 17, 2007 4:44 PM

Thanks Bryan. In the end I resorted to writing a web service to run the
stored procedure and that seems to be working fine. It seems like a pretty
convoluted process, just to generate and sequential numbers, but at this
point I'll take whatever works :).

Thanks for at least confirming that I wasn't going crazy.

Dana
reply

 
 

Previous Microsoft Infopath conversation.