SQL Server Dynamic Query SQL Server without using Dynamic SQL but with XML

There always seems to be  a need for dynamic SQL, but security seems too limit where it can be used.  I found the article and it seemed very intriguing, but have not been able to deeply look into it, so I’m going to put it here for future reading.
 
"Running a Dynamic Query against SQL Server without using Dynamic SQL"

JavaScript IE FireFox onload

There are problems with FireFox using onload.  Most of the documentation and articles that I have read identifies that FireFox does not support onload.  I currently have FireFox 3 installed and onload seems to work.  But I have not been able to test onload on previous versions of FireFox.
 
I’m probably going to have to implement a solution for previous version of FireFox.  I have found some good reference of doing onload with previous version of FF, but do not have time to implement it right now.  I’m just going to put the references here so I can find them later.
 
 
BWCJP posted the following code at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2811631&SiteID=1
I believe the latest version of fire fox and likely the previous version require ‘document’ and not window as thats for IE and Opera accepts window also
//set page event handlers
if (window.attachEvent) {
  //IE and Opera
  window.attachEvent("onload", Page_Load);
  window.attachEvent("onunload", Page_Unload);
} else {
  //FireFox
  document.addEventListener("DOMContentLoaded", Page_Load, false);
  document.addEventListener("unload", Page_Unload, false);
}
 
Reference
Firefox IE7 onload event question
 
The window.onload Problem – Solved!

Passing Dictionary From JavaScript to ASP.NET Web Service

The ASP.NET project that I’m currently working on uses AJAX to save data to a Web Service.  The web service is generic.  The web page should be able to pass address, phone numbers, sales info and etc to the web service.  Base on the key that is also passed to the web service, the web service should know how to save the data.
 
The first version of the client code that called the web service gathered all the data from the form and created a string that was pipe delimited.  Example: key=person|keyid=333323|firstname=John|lastname=Handcock.   When this information arrives at the web service it must be parsed and saved. A lot of red flags seem to pop up with this design.
 
Here’s the web service signature or the first version
[ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet=false)]
public string Save(string input)
 
There will always be a few fields that will be passed (key and keyID) to the web service.  The problem is that data fields (firstname, lastname, address and etc) could be different.  I figured out that I could add .NET Dictionary type to as a parameter to web service call.  The problem now is how do I gather and pass this information from the client javascript.
 
Here’s the the new save method web service
[ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet=false)]
public string Save(string key, string keyID, Dictionary<string, string> inputNameValue)
 
I could use the following JavaScript to pass data to the web service and it works, but the data values (first, last) need to be created dynamically. 
MoFormSave.Save(key, keyID, {"first":"john","last":"handcock"})
 
I tried to create an array that accepts an NameValue object and pass the object to web service, but this errors when I call the web service.  I finally figure out I could do the following and pass the object to the web service.
 
   var nameValue = {}; //new, empty object
   nameValue[‘first’] = ‘John’;
   nameValue[‘last’] = ‘Handcock’;
   MoFormSave.Save(key, keyID,  nameValues)
 
 
Resources:
Quick guide to somewhat advanced JavaScript – tour of some OO features
 
 

JavaScript Modal While Processing

On the current ASP.NET project that I’m working on, I’m using AJAX to save the user input to a WebMethod(WebService).  While the save is running the user needs to be prompted that their data is being save.  At this time the user should not be able to do any other action on the page until the save has completed. 
 
Below are the resource that I used to solve this problem. All the resources but the first were fairly complex.  The first resource did a very good job of  solving my problem.  I listed the other resource because they provided some additional information.
 
Resources:
Modal-style pops in Javascript and CSS (The simplest and it works; works in IE7 and FireFox 3)
http://weblogs.asp.net/jeff/archive/2006/10/25/Modal_2D00_style-pops-in-Javascript-and-CSS.aspx
 
Lightbox Gone Wild (JavaScript Libary) (Looks fairly complex)
http://particletree.com/features/lightbox-gone-wild/
 
 
Javascript Modal Dialog Tutorial (Discusses issues that browses have)
http://luke.breuer.com/tutorial/javascript-modal-dialog.aspx
 
 
Modal Dialog Box – modalDialog.js (JavaScript Library)
http://www.applicationgroup.com/tutorials/modalDialog/modalDialog.asp