Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Windows 7 Gadget and SQL Server


  • Please log in to reply
3 replies to this topic

#1 KamakaZ

KamakaZ

  • Members
  • 739 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Victoria
  • Local time:01:55 PM

Posted 12 October 2010 - 08:04 PM

Hi Guys,

I'm looking at creating a Windows 7 gadget the will connect to the sql server (using a DSN, would be great if it could do it directly) run a SQL command (select top5 * from x) and then display the results in a table. I would then have the gadget refresh every x minutes.

I have been looking online but can't seem to find to much, the languages for creating gadgets are pretty limited, although I think I'll have to use AJAX.

Any help or tutorials would be GREATLY APPRECIATED! :thumbsup:

Cheers.

There's no place like 127.0.0.1
There are 10 types of people in the world, those that can read binary, and those who can't.


BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:08:55 PM

Posted 13 October 2010 - 02:40 PM

Are you talking about Windows gadgets? They are written using Javascript and HTML. The Windows sidebar could be perceived as sort of a mini-browser.

#3 KamakaZ

KamakaZ
  • Topic Starter

  • Members
  • 739 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Victoria
  • Local time:01:55 PM

Posted 14 October 2010 - 04:43 PM

Thanks, I managed to figure it out, it's unfortunate that there really isn't much good documentation out there on this sort of thing.

<html>
<head>
<title>Open Jobs</title>
<script type="text/javascript">
function loading()
	{
	this.document.body.style.width = 300;
	this.document.body.style.height = 650;
	this.document.body.style.margin = 0;	
	
setInterval("checkjobs()",60000);
	
}

function checkjobs() {
	adOpenForwardOnly = 0;
	adLockReadOnly = 1;
	adCmdText = 1;
	
	var myConnect = "Data Source=DATASOURCE;"; 

	var ConnectObj = new ActiveXObject("ADODB.Connection");
	var RS2 = new ActiveXObject("ADODB.Recordset");
	var sql="SQL COMMAND";

	ConnectObj.Open (myConnect);
	RS2.Open(sql,ConnectObj,adOpenForwardOnly,adLockReadOnly,adCmdText);

	//var fieldCount = RS.Fields.Count;
	var div2innerHTML = "<table id='jobs' border='0' align='left' style='overflow:hidden;' width='100%'><tr><td colspan='3'><h4>Open Jobs</h4g></td></tr>";
	RS2.MoveFirst;
	while(!RS2.EOF){
		div2innerHTML = div2innerHTML + "<tr><td><strong>Job:</strong> " + RS2('Job_No') + " <strong>Account:</strong> " + RS2('Account_Code') + " <strong>Type:</strong> " + RS2('Job_Type') + " <strong>Logged By:</strong> " + RS2('Logged_By') + "</td></tr><tr><td><strong>Debtor Name:</strong> " + RS2('Debtor_Name') + "</td></tr><tr><td>" + RS2('Comments') + "</td></tr><tr><td>&nbsp;</td></tr>";
		RS2.MoveNext;
	}
	
	div2innerHTML = div2innerHTML + "</table>"
	document.getElementById("div2").innerHTML = div2innerHTML;

}



</script>
</head>
<body onLoad="loading();" bgcolor="#d6e3f2">
<table width="75%" align="center">
<tr>
<td>
<div id="div2">Error!!</div>
</td>
</tr>
</table>

</body>
</html>

There's no place like 127.0.0.1
There are 10 types of people in the world, those that can read binary, and those who can't.


#4 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:08:55 PM

Posted 14 October 2010 - 04:45 PM

it's unfortunate that there really isn't much good documentation out there on this sort of thing.

I learned how to do them by looking at what others had done.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users