<?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>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: SQL Query</title><link>https://www.infopathdev.com:443/forums/thread/6964.aspx</link><pubDate>Tue, 14 Jun 2005 20:32:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:6964</guid><dc:creator>jimmyfo</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/6964.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=6964</wfw:commentRss><description>Thank you, Scott! Works great, you've helped me a lot - &lt;br /&gt;&lt;br /&gt;James</description></item><item><title>Re: SQL Query</title><link>https://www.infopathdev.com:443/forums/thread/6963.aspx</link><pubDate>Tue, 14 Jun 2005 17:00:00 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:6963</guid><dc:creator>ScottAtRVC</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/6963.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=6963</wfw:commentRss><description>Hi.&lt;br /&gt;&lt;br /&gt;If i understand you correct.  &lt;br /&gt;You want to determine if the name James_Fogarty exists in the applicantTable table?&lt;br /&gt;&lt;br /&gt;If so, i believe you want to change your current SQL statemen:&lt;br /&gt;var strSQLQuery = "select name '" + queryName.text + "' from applicantTable";&lt;br /&gt;&lt;br /&gt;TO&lt;br /&gt;&lt;br /&gt;var strSQLQuery = "select name from applicantTable WHERE name = '" + queryName.text + "'";&lt;br /&gt;&lt;br /&gt;Cheers. Scott.&lt;br /&gt;</description></item><item><title>SQL Query</title><link>https://www.infopathdev.com:443/forums/thread/4711.aspx</link><pubDate>Mon, 13 Jun 2005 14:56:13 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:4711</guid><dc:creator>jimmyfo</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/4711.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=4711</wfw:commentRss><description>Hey all, I'm trying to check a SQL database for an existing value (the primary key) and return whether it is there or not. The query I am using is listed below:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;function CTRL415_7::OnClick(eventObj)&lt;br /&gt;{&lt;br /&gt;/*&lt;br /&gt;//WORKS BUT CANNOT RETURN VALUE&lt;br /&gt;oConn = new ActiveXObject("ADODB.Connection");&lt;br /&gt;oConn.ConnectionString = XDocument.QueryAdapter.Connection;&lt;br /&gt;oConn.ConnectionTimeout = XDocument.QueryAdapter.Timeout;&lt;br /&gt;oConn.Open();&lt;br /&gt;oConn.Execute("EXEC dbo.Test");&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;	// Get the default SQL command for the form.&lt;br /&gt;  var strOrigSQLCommand = XDocument.QueryAdapter.Command;&lt;br /&gt;&lt;br /&gt;  //Set the value of the datafield.&lt;br /&gt;  var queryName = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:applicantTable/@name");&lt;br /&gt;&lt;br /&gt;  // Construct the full query string.&lt;br /&gt;  var strSQLQuery = "select name '" + queryName.text + "' from applicantTable";&lt;br /&gt;&lt;br /&gt;  // This is the query.&lt;br /&gt;  XDocument.UI.Alert(strSQLQuery);&lt;br /&gt;&lt;br /&gt;  // Run the query.&lt;br /&gt;  XDocument.QueryAdapter.Command = strSQLQuery;&lt;br /&gt;  try&lt;br /&gt;  {&lt;br /&gt;	XDocument.Query();&lt;br /&gt;	XDocument.UI.Alert("Value for name in database.");&lt;br /&gt;  }&lt;br /&gt;  catch(ex)&lt;br /&gt;  {&lt;br /&gt;	XDocument.UI.Alert("Name not in database or invalid return./n/n" + ex.number + " " + ex.description);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  //Restore the default table command (for the next time).&lt;br /&gt;  XDocument.QueryAdapter.Command = strOrigSQLCommand;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The error message I get on runtime is:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;The following error occurred:&lt;br /&gt;&lt;br /&gt;The query method on the Document object failed.&lt;br /&gt;InfoPath cannot run the specified query.&lt;br /&gt;The XML data returned from the data source does not match the XML Schema for this form. This discrepancy might be caused by the data source returning multiple rows when InfoPath expects only one.&lt;br /&gt;Attribute 'James_Fogarty' is not allowed on element '&lt;a target="_blank" href=http://schemas.microsoft.com/office/infopath/2003/ado/dataFields}applicantTable'&gt;http://schemas.microsoft.com/office/infopath/2003/ado/dataFields}applicantTable'&lt;/a&gt;, according to Schema.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;File:script.js&lt;br /&gt;Line:150&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The value is in the table and it occurs only once. Any ideas?&lt;br /&gt;&lt;br /&gt;Thanks.&lt;br /&gt;&lt;br /&gt;James</description></item></channel></rss>