<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Is there a problem with my SQL statement?</title><link>https://www.infopathdev.com:443/forums/thread/2612.aspx</link><pubDate>Wed, 21 Jun 2006 13:41:43 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:2612</guid><dc:creator>.mond</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/2612.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=2612</wfw:commentRss><description>Ok, i do have insert permissions and the query seems to be working but for some very strange reason it seems that the records are being added then being deleted.&lt;br /&gt;&lt;br /&gt;&lt;blockquote id="quote"&gt;&lt;font size="1" face="Verdana, Arial, Helvetica" id="quote"&gt;quote:&lt;hr height="1" noshade id="quote"&gt;&lt;br /&gt;1000	White		Johnson		Belleville	1	0&lt;br /&gt;1001	Green		Marjorie	Hillaby		1	0&lt;br /&gt;1002	Carson		Cheryl		Gibbons		1	0&lt;br /&gt;1003	O'Leary		Michael		Lowlands	1	0&lt;br /&gt;1004	Straight	Dean		West Terrace	1	0&lt;br /&gt;1005	Smith		Meander		Kensignton	0	0&lt;br /&gt;1006	Bennet		Abraham		Church Gap	1	0&lt;br /&gt;1007	Dull		Ann		Brittons Hill	1	0&lt;br /&gt;1008	Gringlesby	Burt		Pickwick Gap	1	0&lt;br /&gt;1009	Locksley	Charlene	Kirtons		1	0&lt;br /&gt;1010	Greene		Morningstar	Drill Hall	0	0&lt;br /&gt;1011	Blotchet-Halls	Reginald	Bonnets		1	0&lt;br /&gt;1012	Yokomoto	Akiko		Farmers		1	0&lt;br /&gt;1013	del Castillo	Innes		Turners Hall	1	0&lt;br /&gt;1014	DeFrance	Michel		Kendal		1	0&lt;br /&gt;&lt;b&gt;1015	Stringer	Dirk		Vaucluse	0	0&lt;br /&gt;1021	Smith		Meander		Jackmans	1	1&lt;br /&gt;1025	Smith		Meander		Belleville	0	0&lt;br /&gt;1027	Jones		Bob		Here		0	0&lt;/b&gt;&lt;br /&gt;&lt;hr height="1" noshade id="quote"&gt;&lt;/font id="quote"&gt;&lt;/blockquote id="quote"&gt;&lt;br /&gt;Notice the last four records, where there are gaps in the IDs of the records which would indicate that records were in fact added but for some odd reason deleted or discarded.</description></item><item><title>Re: Is there a problem with my SQL statement?</title><link>https://www.infopathdev.com:443/forums/thread/2611.aspx</link><pubDate>Tue, 20 Jun 2006 14:54:55 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:2611</guid><dc:creator>.mond</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/2611.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=2611</wfw:commentRss><description>yeah i think i have insert permissions, but wouldnt i get some sort of error message if i didnt?</description></item><item><title>Re: Is there a problem with my SQL statement?</title><link>https://www.infopathdev.com:443/forums/thread/2610.aspx</link><pubDate>Tue, 20 Jun 2006 14:38:37 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:2610</guid><dc:creator>dlgross</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/2610.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=2610</wfw:commentRss><description>do you have insert permissions on the DB?</description></item><item><title>Is there a problem with my SQL statement?</title><link>https://www.infopathdev.com:443/forums/thread/1369.aspx</link><pubDate>Tue, 20 Jun 2006 14:08:49 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:1369</guid><dc:creator>.mond</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/1369.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=1369</wfw:commentRss><description>Hi, &lt;br /&gt;I am trying to customize my submit operation with JScript code so that only records that have a check mark in the 'submit' field will be sent to the database.  Here is what i have come up with:&lt;br /&gt;&lt;blockquote id="quote"&gt;&lt;font size="1" face="Verdana, Arial, Helvetica" id="quote"&gt;quote:&lt;hr height="1" noshade id="quote"&gt;&lt;br /&gt;function submit_button::OnClick(eventObj)&lt;br /&gt;{	&lt;br /&gt;	// invoke the OnSubmitRequest event handler&lt;br /&gt;	XDocument.Submit();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function XDocument::OnSubmitRequest(eventObj)&lt;br /&gt;{&lt;br /&gt;	// If the submit operation is successful, set&lt;br /&gt;	// eventObj.ReturnStatus = true;&lt;br /&gt;	&lt;br /&gt;	var objDOMNode; // stores a node in the DOM&lt;br /&gt;	var objNamedNodeMap; // stores a collection of node attributes &lt;br /&gt;	var objADOAdapter; // data adapter used to connect to the database&lt;br /&gt;	var objDOMNodeList; // stores a list of DOM nodes&lt;br /&gt;	var strSQLInsert; // stores an SQL insert statement&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;	// create a DOM Node List to put all the author nodes into&lt;br /&gt;	try&lt;br /&gt;	{&lt;br /&gt;		objDOMNodeList = XDocument.DOM.selectNodes("/dfs:myFields/dfs:dataFields//d:authors2");&lt;br /&gt;	}&lt;br /&gt;	catch(ex)&lt;br /&gt;	{&lt;br /&gt;		XDocument.UI.Alert("Could not create XMLDOMNodeList object.\r\n" &lt;br /&gt;							+ ex.number + " - " + ex.description);&lt;br /&gt;		// Return with eventObj.ReturnStatus == false (the default value) &lt;br /&gt;		return;	&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	// get the ADO data adapter for the database connection&lt;br /&gt;	objADOAdapter = XDocument.QueryAdapter;&lt;br /&gt;	&lt;br /&gt;	// loop through all the records to find the ones that have the resubmit field checked&lt;br /&gt;	while( objDOMNode = objDOMNodeList.nextNode() )&lt;br /&gt;	{&lt;br /&gt;		// get the attribute list for the current DOM Node&lt;br /&gt;		objNamedNodeMap = objDOMNode.attributes; &lt;br /&gt;		&lt;br /&gt;		// &amp;lt;DEBUGGING&amp;gt;	&lt;br /&gt;		//XDocument.UI.Alert("objNamedNodeMap.getNamedItem(\"submit\"): " + objNamedNodeMap.getNamedItem("submit").xml);&lt;br /&gt;		// &amp;lt;/DEBUGGING&amp;gt;&lt;br /&gt;		&lt;br /&gt;		// Filter out the records that are to be submitted to the database&lt;br /&gt;		if( objNamedNodeMap.getNamedItem("submit").nodeValue == "True" )&lt;br /&gt;		{&lt;br /&gt;			// store the attributes of the current node&lt;br /&gt;			ln = objNamedNodeMap.getNamedItem("lname").nodeValue;&lt;br /&gt;			fn = objNamedNodeMap.getNamedItem("fname").nodeValue;		&lt;br /&gt;			addr = objNamedNodeMap.getNamedItem("address").nodeValue;&lt;br /&gt;			// if the string value is False assign 0 to avoid conversion problems when submitting to the database&lt;br /&gt;			contract = ( (objNamedNodeMap.getNamedItem("contract").nodeValue == "False")? 0 : 1 );&lt;br /&gt;			// always set to 0 so that when queries are run none of the records will have a check mark in the submit field&lt;br /&gt;			// which could lead to new records being submitted by mistake&lt;br /&gt;			submit = 0; &lt;br /&gt;					&lt;br /&gt;			// &amp;lt;DEBUGGING&amp;gt;	&lt;br /&gt;			XDocument.UI.Alert("contract: " + contract);&lt;br /&gt;			// &amp;lt;/DEBUGGING&amp;gt;&lt;br /&gt;						&lt;br /&gt;			strSQLInsert = "INSERT INTO authors2(lname,fname,address,contract,submit) VALUES(" + &lt;br /&gt;							"'"+ln+"'" + "," + "'"+fn+"'" + "," + "'"+addr+"'" + "," + contract + "," + submit + ")";&lt;br /&gt;							&lt;br /&gt;			objADOAdapter.Command = strSQLInsert;&lt;br /&gt;			&lt;br /&gt;			// &amp;lt;DEBUGGING&amp;gt;	&lt;br /&gt;			XDocument.UI.Alert("SQL command: " + objADOAdapter.Command);&lt;br /&gt;			// &amp;lt;/DEBUGGING&amp;gt;&lt;br /&gt;			&lt;br /&gt;			try&lt;br /&gt;			{&lt;br /&gt;				objADOAdapter.Query();&lt;br /&gt;			}&lt;br /&gt;			catch(ex)&lt;br /&gt;			{&lt;br /&gt;				XDocument.UI.Alert("Error executing insert query.\r\n" &lt;br /&gt;							+ ex.number + " - " + ex.description);&lt;br /&gt;				// Return with eventObj.ReturnStatus == false (the default value) &lt;br /&gt;				return;	&lt;br /&gt;			}&lt;br /&gt;		}&lt;br /&gt;		// set eventObj.ReturnStatus = true &lt;br /&gt;		eventObj.ReturnStatus = true;&lt;br /&gt;	}&lt;br /&gt;	// store the id attribute from the first author node encountered&lt;br /&gt;}&lt;br /&gt;&lt;hr height="1" noshade id="quote"&gt;&lt;/font id="quote"&gt;&lt;/blockquote id="quote"&gt;&lt;br /&gt;&lt;br /&gt;With the above code i don't get any errors but when i check the corresponding database i see that a new record has not been added.&lt;br /&gt;&lt;br /&gt;Any idea what the problem might be?</description></item></channel></rss>