I just finished reading Microsoft SQL Server 2005 Reporting Services 2005 by Brian Larson. It's a pretty good introductory book, and after reading the first 11 chanpters, and skimming the last couple, I think I've got a pretty good idea on how to get started with SSRS2005. Unfortunately, by the time I actually get to use any of this, we'll probably be on SSRS2008, and I'll have to get the next version, but hopefully there won't be a lot of changes.
I'm currently digging into SQL Server Free Text searching and other search engines to be used for searching relational databases. The SQL Free Text search has a few major downsides:
1. It can only index one database
2. You need to actively update the database indexes on a schedule, or the search will not get accurate information
3. You need to specify the columns to include in your searches through your indexing.
This may still work to do what I need, but there will be a lot more effort than originally planned.
I am also researching and comparing LINQ, CSLA, NHibernate and the Microsoft Entity Frameworks for use in my data layers. No winners yet, as they all offer benefits. The biggest loser in using these tools is WCF, since using WCF removes a great deal of the capabilities built into each of these tools for CRUD operations.
Finally, I've been cracking open Visual Studio 2008, mainly to look at LINQ and new ASP.NET functionality.
More to learn, always more to learn.
Monday, January 14, 2008
Friday, December 21, 2007
Custom Soap Fault
Here's some code to Build a custom soap exception so you don't return a standard Exception from a web service. I'm sure there are better ways to do this these days, but I've been using this for 4 years.
#region BuildSoapFault
///
/// Build a custom soap error message
///
/// The string to add to the message
///A Soap Exception
///
private SoapException BuildSoapFault(string message)
{
// Build the detail element of the SOAP fault.
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
System.Xml.XmlNode node = doc.CreateNode(XmlNodeType.Element,
SoapException.DetailElementName.Name,SoapException.DetailElementName.Namespace);
// Build specific details for the SoapException.
// Add first child of detail XML element.
System.Xml.XmlNode details =
doc.CreateNode(XmlNodeType.Element, "mySpecialInfo1",
"http://tempuri.org/");
System.Xml.XmlNode detailsChild =
doc.CreateNode(XmlNodeType.Element, "childOfSpecialInfo",
"http://tempuri.org/");
details.AppendChild(detailsChild);
// Add second child of detail XML element with an attribute.
System.Xml.XmlNode details2 = doc.CreateNode(XmlNodeType.Element, "mySpecialInfo2",
"http://tempuri.org/");
XmlAttribute attr = doc.CreateAttribute("t", "attrName",
"http://tempuri.org/");
attr.Value = "attrValue";
details2.Attributes.Append(attr);
// Append the two child elements to the detail node.
node.AppendChild(details);
node.AppendChild(details2);
SoapException se = new SoapException(message,
SoapException.ServerFaultCode,
Context.Request.Url.AbsoluteUri ,
node);
return se;
}
#endregion
#region BuildSoapFault
///
/// Build a custom soap error message
///
/// The string to add to the message
///
///
private SoapException BuildSoapFault(string message)
{
// Build the detail element of the SOAP fault.
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
System.Xml.XmlNode node = doc.CreateNode(XmlNodeType.Element,
SoapException.DetailElementName.Name,SoapException.DetailElementName.Namespace);
// Build specific details for the SoapException.
// Add first child of detail XML element.
System.Xml.XmlNode details =
doc.CreateNode(XmlNodeType.Element, "mySpecialInfo1",
"http://tempuri.org/");
System.Xml.XmlNode detailsChild =
doc.CreateNode(XmlNodeType.Element, "childOfSpecialInfo",
"http://tempuri.org/");
details.AppendChild(detailsChild);
// Add second child of detail XML element with an attribute.
System.Xml.XmlNode details2 = doc.CreateNode(XmlNodeType.Element, "mySpecialInfo2",
"http://tempuri.org/");
XmlAttribute attr = doc.CreateAttribute("t", "attrName",
"http://tempuri.org/");
attr.Value = "attrValue";
details2.Attributes.Append(attr);
// Append the two child elements to the detail node.
node.AppendChild(details);
node.AppendChild(details2);
SoapException se = new SoapException(message,
SoapException.ServerFaultCode,
Context.Request.Url.AbsoluteUri ,
node);
return se;
}
#endregion
Monday, December 17, 2007
More frequent updates
This is my penance post.
I will update this blog more frequently.
I will update this blog more frequently.
I will update this blog more frequently.
I will update this blog more frequently.
I will update this blog more frequently.
I will update this blog more frequently.
I will update this blog more frequently.
I will update this blog more frequently.
I will update this blog more frequently.
I will update this blog more frequently.
Okay, I cheated. I love cut and paste.
I will update this blog more frequently.
I will update this blog more frequently.
I will update this blog more frequently.
I will update this blog more frequently.
I will update this blog more frequently.
I will update this blog more frequently.
I will update this blog more frequently.
I will update this blog more frequently.
I will update this blog more frequently.
I will update this blog more frequently.
Okay, I cheated. I love cut and paste.
Closing Connections in a WCF Broker Proxy
The followinde is pretty standard WCF code. The critical step is the using statement. Failure to do this step will hang the server once you have reached your max connections, and will result in bizarre behavior.
public ATCFlightPlan GetATCFlightPlan(int fltsegid)
{
ATCFlightPlan atcFlightPlan = null;
//Create connection to FlightPlanService
WSHttpBinding httpBind = new WSHttpBinding();
ChannelFactory flightPlanProcessServiceFactory = new ChannelFactory(httpBind, primaryEndpoint);
IFlightPlanProcessManager flightPlanProcessManagerClient = flightPlanProcessServiceFactory.CreateChannel();
using (flightPlanProcessManagerClient as IDisposable)
{
try
{
atcFlightPlan = flightPlanProcessManagerClient.GetATCFlightPlan(fltsegid);
}
catch (FaultException ex)
{
EventLog.WriteEntry("FlightPlanBroker", "Fault Exception thrown from Primary FlightPlanSvc: " + ex.ToString());
throw;
}
catch (Exception ex)
{
EventLog.WriteEntry("FlightPlanBroker", "Error communicating with Primary FlightPlanSvc: " + ex.ToString());
ChannelFactory backupFlightPlanProcessServiceFactory = new ChannelFactory(httpBind, backupEndpoint);
IFlightPlanProcessManager backupFlightPlanProcessManagerClient = backupFlightPlanProcessServiceFactory.CreateChannel();
using (backupFlightPlanProcessManagerClient as IDisposable)
{
try
{
atcFlightPlan = backupFlightPlanProcessManagerClient.GetATCFlightPlan(fltsegid);
FailOverEndpoints();
}
catch (FaultException innEx)
{
EventLog.WriteEntry("FlightPlanBroker", "Fault Exception thrown from Backup FlightPlanSvc: " + innEx.ToString());
throw;
}
catch (Exception innEx)
{
EventLog.WriteEntry("FlightPlanBroker", "Error communicating with backup FlightPlanSvc: " + innEx.ToString());
throw;
}
}
}
}
return atcFlightPlan;
}
public ATCFlightPlan GetATCFlightPlan(int fltsegid)
{
ATCFlightPlan atcFlightPlan = null;
//Create connection to FlightPlanService
WSHttpBinding httpBind = new WSHttpBinding();
ChannelFactory
IFlightPlanProcessManager flightPlanProcessManagerClient = flightPlanProcessServiceFactory.CreateChannel();
using (flightPlanProcessManagerClient as IDisposable)
{
try
{
atcFlightPlan = flightPlanProcessManagerClient.GetATCFlightPlan(fltsegid);
}
catch (FaultException ex)
{
EventLog.WriteEntry("FlightPlanBroker", "Fault Exception thrown from Primary FlightPlanSvc: " + ex.ToString());
throw;
}
catch (Exception ex)
{
EventLog.WriteEntry("FlightPlanBroker", "Error communicating with Primary FlightPlanSvc: " + ex.ToString());
ChannelFactory
IFlightPlanProcessManager backupFlightPlanProcessManagerClient = backupFlightPlanProcessServiceFactory.CreateChannel();
using (backupFlightPlanProcessManagerClient as IDisposable)
{
try
{
atcFlightPlan = backupFlightPlanProcessManagerClient.GetATCFlightPlan(fltsegid);
FailOverEndpoints();
}
catch (FaultException innEx)
{
EventLog.WriteEntry("FlightPlanBroker", "Fault Exception thrown from Backup FlightPlanSvc: " + innEx.ToString());
throw;
}
catch (Exception innEx)
{
EventLog.WriteEntry("FlightPlanBroker", "Error communicating with backup FlightPlanSvc: " + innEx.ToString());
throw;
}
}
}
}
return atcFlightPlan;
}
Tuesday, September 11, 2007
Getting Started with SQL Server
After many years of trying to work SQLServer into my daily life, I've finally got a project that I can use it. Of course, I still need to attach back to the Informix database where most of my data resides. The following code snippet allows SQLServer to pass a preformatted query through to Informix as a Linked Server.
USE [Dispatch]
GO
/****** Object: StoredProcedure [dbo].[ExecOpenQuery] Script Date: 09/11/2007 08:47:54 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[ExecOpenQuery] (
@TSQL varchar(8000)
)
AS
SET NOCOUNT ON
-- Build OpenQuery command
DECLARE @OpenQuery varchar(4000)
SET @OpenQuery = 'SELECT * FROM OPENQUERY(IfxVisops, '''
-- Display Dynamic SQL
print @OpenQuery + @TSQL
-- Execute SQL
exec(@OpenQuery + @TSQL)
RETURN
USE [Dispatch]
GO
/****** Object: StoredProcedure [dbo].[ExecOpenQuery] Script Date: 09/11/2007 08:47:54 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[ExecOpenQuery] (
@TSQL varchar(8000)
)
AS
SET NOCOUNT ON
-- Build OpenQuery command
DECLARE @OpenQuery varchar(4000)
SET @OpenQuery = 'SELECT * FROM OPENQUERY(IfxVisops, '''
-- Display Dynamic SQL
print @OpenQuery + @TSQL
-- Execute SQL
exec(@OpenQuery + @TSQL)
RETURN
Subscribe to:
Posts (Atom)