Solved

Infopath Changing data before submiting to SQL

Posted on 2010-08-26
10
308 Views
Last Modified: 2012-05-10
I have a form that submits data to  MS sql database.
The form has a repeating table with several fields.
This was working fine until I added a secondary data source to the same sql table.
This was to query some of the data fields.
Now when I submit the data to the main connection the data in my repeating table changers before it is put in the database
So I have two fields in my form that are start time and finish time
If I put 8:00 in my start time and 9:00 in my finish time then submit the data
I get the same data in my database.
But if I add another row to my repeating table with a start time of 10:00 and a finish time of 11:00
Then submit
The new row has a start time of 8:00 and a finish time of 9:00 the same as the first entry.
The data in the sql database is the same.
But if I clear the form before adding the new data this the data is correct.  
The form was working until I added a secondary connection to the database  
Any ideas as this is driving me mad
0
Comment
Question by:LeePrice
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 15

Expert Comment

by:melli111
ID: 33533746
Check you text box in the repeating table for the start time and end time - do you have any default values?  OR do you have any rules that update these fields?  You can use the logic inspector and look through to see if anything else updates those particular fields.    (Tools > Logic Inspector...)
0
 

Author Comment

by:LeePrice
ID: 33533855
i have checked and nothing is being set.
i wasn't clear before in my question.
This is hapening with all the fields in the repeating table.
i just used the start time and finish times as an example
thanks for the prompt reply
0
 
LVL 15

Expert Comment

by:melli111
ID: 33533994
I'm working on re-producing this error.  What do you use the secondary datasource for?  i.e. what are you pulling in from it and are you storing any values from it in the new data?
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:LeePrice
ID: 33534182
i was using the secondry data source to pull the total meters cut for the past 7.
the sql query that i was using is

select Distinct("TotalMetersCut"),"FaceDate" from "dbo"."Face" as "Face" Where "FaceDate" > getdate()-7

just so you know im using infopath 2010 and ms sql 2005 on a windows 7 pc
i hope this helps.
0
 
LVL 15

Expert Comment

by:melli111
ID: 33534303
I haven't used infopath 2010 yet so hopefully there's no difference between versions that may be causing this.  would you mind sharing your form?  You can attach it to this post if you save a copy of it as a .txt; then I'll download it, save it and change it back to .xsn.  If you don't want to that's ok, it's just a little easier to diagnose looking at it
0
 

Author Comment

by:LeePrice
ID: 33534718
attached is the form saved as txt.

FaceReportV07.txt
0
 
LVL 15

Expert Comment

by:melli111
ID: 33534971
OK, I think I got it - it's hard for me to tell for sure since I can't test it (submit) since I obviously don't have the same database tables.  
At the header of your form you have the date, shift, and the face.  These are bound to the query fields in your main connection.  These query fields pull the information from the database to display in the data fields.  When you submit that first line of data is going into the database and those query fields see it in the query, setting the remaining datafields' values in the repeating table to the first line.  
Action:  Change the header fields at the top of your form either to the datafields (not query)  from your main connection or you can create fields for them in your HelperFields.
0
 

Author Comment

by:LeePrice
ID: 33535340
thank you for the reply. I have just tried your sugestion. I have remoed the header fields but I'm still getting the same problems. can you see nything else?
0
 
LVL 28

Accepted Solution

by:
clayfox earned 250 total points
ID: 33535398
I have had this issue.

The data looks great in InfoPath right before submit.

Submit to SQL and the last record is repeated instead of the new record.

I think it is a bug.  The only way I have fixed it is to back track to my previous version before the last change and do it again.

I think something corrupts sometimes to cause this.

Hopefully you have a saved version from before the modification you made.

Save often and test often to make sure it has not broken. I have not had it happen twice but I have had it occur on a couple different forms and with both 2005 and 2008 databases and in InfoPath 2010 and 2007.
0
 

Author Comment

by:LeePrice
ID: 33540399
thats exactly the problem.

well thank you both for your help.
its not quite the answer i was looking for but at least i know i wasn't doing something worng.
Clayfox im going to take your advice and save and test more frequently!
thank you both.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question