Geeks With Blogs
Shailen Sukul blog
19
Dec 09

My blog is now available at http://shailen.sukul.org

 



public { fName += xDoc.Load(fName); } static string GetAppConfig(string key)string fName = Assembly.GetExecutingAssemb... xDoc = new XmlDocument();XmlNode xNode = xDoc.SelectSingleNode("/con... keyNode = xNode.SelectSingleNode(stri... ......

I have noticed an anamoly with doing XML Transformations in .Net. If the XSLT marks specific sections as CDATA, the output seems to missing that. Example: XSLT: <xsl:output method="xml" omit-xml-declaration="yes" encoding="UTF-8" indent="yes" cdata-section-elements="EMP... EMPFIRST"/> We would expect output to be of the format: <Employee> ......

The following is a handy piece of code for extracing an embedded stream of characters from your assembly and saving to a text file. 1. Set the resource to Embedded. 2. Copy the following piece of code: public static void WriteResourceToFile(string resourceName, string fileName) { using (Stream s = Assembly.GetExecutingAssemb... ......

I hope the following will save you some time when dealing with custom windows installers. If you want to access the installation path in your customer installer class, your first instinct might be to use a [TARGETDIR] or [INSTALLDIR] as a custom action (for example /DIR=[TARGETDIR]) and attempt to access that in your custom installer class (for example. ......

The query below shows how to create an XML document using FOR XML from a table (based on Sql Server 2000). To start with, run the sql script further below to create the sample table, and populate it with some data. Once the select script is run, data will be returned in the form: <Employees> <Employee> <field1></field1> ... </Employee> ......

I recently implemented a custom role provider for an asp.net project and discovered an interesting point. I had to instantiate a role business component in the custom provider class like so: public class MyRoleProvider : RoleProvider { BLRole blRole = null; public MyRoleProvider() { blRole = new BLRole(); } All I could see on at runtime was: Parser ......

I got the above error message when uninstalling a Windows Service setup from the Add/Remove option. If you ever get an error message like above, then one or dependent assemblies for your installed application may be missing. Try to locate and install the dependent assemblies manually and then Remove the project using the Add/Remove option ......

HTTP GET/POST are disabled by default on web servers in the new .NET 1.1 which could make creating REST-type web services more difficult. The error message you get is: Request format is unrecognized. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about ......

Script to search in stored procs

select  upper(SysObjects.Name),SysComments.Text
from  SysObjects, SysComments  
where  SysObjects.type='P'
and (SysObjects.ID = SysComments.ID)
and SysComments.Text like '%SearchString%'



I ran across this weird problem while debugging a stored procedure in Sql Server 2000. Here's a sample stored procedure: drop procedure p1gocreate procedure p1as create table #t1( col1 int identity(1,1), col2 datetime, col3 int) select *from #t1 return update #t1set col3 = col2return Ok, notice that I have a return statement after the first select. ......

"XML attributes may not be specified for the type"XmlSerializer and CollectionBase derived classesI get this error when I try to serialize an object that is based upon the CollectionBase class and has an XmlRoot attribute.The solution is to provide hints in the Serialization method to add a defined root in the generated XML. Thanks to user "armanddp" ......

MS Logging and Instrumentation BlockError: The type initializer for "Microsoft.Practices.Enterp... threw an exception.Repeat the following for all the code blocks you are using:C:\WINNT\Microsoft.NE... &lt;destinationfolder&a... ......

Intermittent Web Services Error I have a proxy class that performs a large number of calls on a web service. It fails intermittently with the following error: System.Net.WebException: The request failed with HTTP status 401: Unauthorized. at System.Web.Services.Protoco... ReadResponse(SoapClientMessage message, WebResponse response, ......

SQL Server DTC ErrorError Message: Server: Msg 7391, Level 16, State 1, Procedure p_SP1, Line XThe operation could not be performed because the OLE DB provider 'SQLOLEDB' was unable to begin a distributed transaction.[OLE/DB provider returned message: New transaction cannot enlist in the specified transaction coordinator. ]OLE DB error trace [OLE/DB ......

Copyright © Shailen Sukul | Powered by: GeeksWithBlogs.net