Tag Archives: .net

Getting .NET schema for a stored procedure result

Questions: I have a couple of stored procedures in T-SQL where each stored procedure has a fixed schema for the result set. I need to map the result sets for each procedure to a POCO object and need the column name and type for each column in the result set. Is there a quick way… Read More »

Git authentication for perl CGI-Script via .netrc

Questions: I’ve got a little perl-script which attempts to pull from a git repository and then gets some things from git log: use Git::Repository; my $repo = Git::Repository->new( git_dir => $git_path, ); $repo->run(‘pull’) || die $!; my @commits = $repo->run(log); … For the authentication I have a .netrc-file with my credentials in /home/bla. This works… Read More »

WITSML api library for .Net / C# client apps?

Questions: Witsml is an xml data and query standard used in the oil and gas drilling industry. It uses xml for both the data and the query templates when communicating with a server (over http). It’s a bit of a mess to manually construct queries in xml, especially since the templates specify both what elements… Read More »

How to remove xmlns attribute with .NET XML API

Questions: XmlElement.Attributes.Remove* methods are working fine for arbitrary attributes resulting in the removed attributes being removed from XmlDocument.OuterXml property. Xmlns attribute however is different. Here is an example: XmlDocument doc = new XmlDocument(); doc.InnerXml = @”<Element1 attr1=””value1″” xmlns=””http://mynamespace.com/”” attr2=””value2″”/>”; doc.DocumentElement.Attributes.RemoveNamedItem(“attr2”); Console.WriteLine(“xmlns attr before removal={0}”, doc.DocumentElement.Attributes[“xmlns”]); doc.DocumentElement.Attributes.RemoveNamedItem(“xmlns”); Console.WriteLine(“xmlns attr after removal={0}”, doc.DocumentElement.Attributes[“xmlns”]); The resulting output is… Read More »

Json.net: Can JObject.SelectToken do the same thing the XPath can do? If yes what are the syntax?

Questions: The answer to the query posted in 2009 was to use a new feature JObject.SelectToken which is supposed to deliver XPath like functionality. I am now using JSON.NET 4.5 R11 and SelectToken method is available. But I could not find much documentation (basically syntax) regarding the path string to be passed to SelectToken function.… Read More »

SQL View timing out used by .NET Application

Questions: We have a .NET Application using LINQ to SQL (ORM) to call a view which contains joins from multiple objects in different databases. The .NET Application times out calling this view, however our DBA runs the following statement: sp_refreshview on the view and the subsequennt sql views the application starts running again. This application… Read More »

How can I implement jQuery DataTables plugin using C#, ASP.NET, SQL Server side processing?

Questions: How can I implement jQuery DataTables plugin using C#, ASP.NET, SQL Server side processing with ajax and webservices? Would like to implement a Datatables grid using c# and ASP.NET, but it is difficult to find a working example. Answers: This version is for older SqlServer, For newer version ,try the other one. This technique… Read More »

Read Large XML String from TSQL FOR XML Statement in C# .NET

Questions: Have a SQL command with FOR XML that returns a single long XML as SqlString. My problem is reading the long XML string into .NET C#. The following only reads the first 2033 characters SqlDataReader rdr = command.ExecuteReader(); if (rdr.HasRows) { rdr.Read(); Debug.WriteLine(rdr[0].ToString().Length.ToString()); } I have also tried command.ExecuteScalar and rdr.GetString and still only… Read More »