InfoPath, SQL and GUIDs

G

geraldlbauer

I have been having issues with InfoPath and the primary key that is a
GUID. There was a previous post,
http://groups.google.com/group/micr...attern+allowed"&rnum=1&hl=en#3b4c2619a247d4bf,
on this and I found a solution.

What the problem is is that the format pattern associated with the GUID
field within InfoPath is that it wants all the characters to be in
upper case. You have to add code to place the GUID value within the
field. Here is the code I used:
XPathNavigator nav = this.MainDataSource.CreateNavigator();
string val = "{" + Guid.NewGuid().ToString().ToUpper() +
"}";

nav.SelectSingleNode("/dfs:myFields/dfs:dataFields/d:tblInspectionReport/@InternalRptID",
this.NamespaceManager).SetValue(val);

Cheers,

Gerald
 

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