How to get dynamic data from SQL Server using web services

M

Murali Choudari

Hi,
I have a web service, it get's data from the SQL server and displays in
InfoPath UI using web service. I'm able to get the data, whenever user
clicks on the "Run Query".

I don't want like this. If there is any update in the SQL server. Then
InfoPath UI should update automatically(refresh)

Regards,
Murali Choudari.
 
S

Steve van Dongen [MSFT]

Hi,
I have a web service, it get's data from the SQL server and displays in
InfoPath UI using web service. I'm able to get the data, whenever user
clicks on the "Run Query".

I don't want like this. If there is any update in the SQL server. Then
InfoPath UI should update automatically(refresh)

There's no way to push data changes from the server. I've used a task
pane's setTimeout method to periodically poll the server; however,
note that any changes in the form are lost when you call Query().

Regards.
Steve
 
M

Murali Choudari

Hi Steve,
If you have any sample script , please send to me.

Murali Choudari
 
S

Steve van Dongen [MSFT]

Hi Steve,
If you have any sample script , please send to me.

OK, but, I have a fair bit of infrastructure built up in this form,
mainly for supporting user configurable preferences, and I decided to
take some of it out but leave some of it in. The stuff I have left in
-- anything related to my Globals object -- should be self
explanatory.

setTimeout method
<URL:
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/setTimeout.asp
/>

--- script.js ---

var Globals = { ... stuff ... }
var oTaskPane = null;
var gfInitialized = false;

function InitTaskPane()
{
if (null == oTaskPane)
{
if (null == XDocument.View)
return;
oTaskPane = XDocument.View.Window.TaskPanes.Item(0);
}

if (oTaskPane.HTMLDocument.readyState != "complete")
{
return;
}

gfInitialized = true;
}

function GetTaskPaneWindow()
{
if (oTaskPane)
{
if (Globals.HasFullTrust)
return oTaskPane.HTMLWindow;
else
return oTaskPane.HTMLDocument.parentWindow;
}
return null;
}

// Give the click handler for the Refresh button a valid JScript name
// so that it can also be called from script.
RefreshData = function Refresh::OnClick()
{
XDocument.Query();

if (Globals.Preferences.RefreshPeriodically == "T" &&
Globals.Preferences.RefreshInterval)
GetTaskPaneWindow().StartAutoRefresh();
}


--- taskpane.htm ---

var XDocument = null;
var iRefreshTimer = null;
var fAutoRefresh = false;

function Init()
{
// Save a reference to the XDocument
object.
XDocument =
window.external.Window.XDocument;

// Set the initial state of the task
pane contents.
XDocument.Extension.InitTaskPane();
}

function StartAutoRefresh()
{
var iInterval =
XDocument.Extension.Globals.Preferences.RefreshInterval;

if (isNaN(Number(iInterval)))
return false;

if (iRefreshTimer)
clearTimeout(iRefreshTimer);
iRefreshTimer =
setTimeout("Refresh()", iInterval * 1000);
fAutoRefresh = true;

return true;
}

function StopAutoRefresh()
{
if (iRefreshTimer)
clearTimeout(iRefreshTimer);
}

function PauseAutoRefresh()
{
fAutoRefresh = false;
}

function ResumeAutoRefresh()
{
fAutoRefresh = true;
}

function Refresh()
{
if (fAutoRefresh)

XDocument.Extension.RefreshData();
}
 
S

sakieboy

Hey Steve,

I'm having a problem pushing the data back to the Web Service using InfoPath.
Getting the 'Update unable to find TableMapping['Table'] or DataTable
'Table'.' for the DataAdapter Update.

It appears (to me) that the XML that I'm attempting to pass back is not in
the format it wants. How would I check to see if something is actually being
sent back? And, how would I display it, (although, not sure if this part
will help)?


Thanks


Darryl
(e-mail address removed)
 

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