//Parameter Class
public class rptParam
{
public String ParameterName { get; set; }
public String Datatype { get; set; }
public String Prompt { get; set; }
}
//Report Attributes Class
public class rptAttributes
{
public List Parameters { get; set; }
public String DataSourceName { get; set; }
public String CommandText { get; set; }
}
Then you can use this code wherever you want, it's uncommented, my apologies, but it's pretty straightforward anyway:
private rptAttributes ReadFile(string filename)
{
rptAttributes rptAtt = new rptAttributes();
List l = new List();
// Create an XmlReader
using (XmlReader reader = XmlTextReader.Create(filename))
{
reader.ReadToFollowing("DataSourceName");
rptAtt.DataSourceName = "DataSourceName: " + reader.ReadElementContentAsString();
reader.ReadToFollowing("CommandText");
rptAtt.CommandText="CommandText: " + reader.ReadElementContentAsString();
string temp = "";
reader.ReadToFollowing("ReportParameter");
reader.MoveToAttribute("Name");
temp = reader.Value;
reader.ReadToFollowing("DataType");
if (reader.NodeType != XmlNodeType.None)
{
rptParam rp = new rptParam();
rp.ParameterName = temp;
rp.Datatype = reader.ReadElementContentAsString();
reader.ReadToFollowing("Prompt");
rp.Prompt = reader.ReadElementContentAsString();
l.Add(rp);
}
rptAtt.Parameters = l;
}
return rptAtt;
}
Tuesday, March 13, 2012
C# parser for RDL files when using with ReportViewer control
The ASP.NET ReportViewer webcontrol is intended to be used with an RDLC file, which is a stripped down version of an RDL file. RDL files are for using with SSRS reporting services -- that is, where you keep the report on a SQL Server hosted website and can run the reports right there on the website. But if you want to embed an SSRS report into your ASP.NET application (I am doing in a few MVC applications, which is tricky too, but I never posted a blog entry about how to do it), anyway, if you want to include an SSRS report in your application, you use the ReportViewer control and when it loads you basically forcefeed it your connection and your parameters and all that. Well, that annoys me, since the RDL files already have the connection strings and parameters in them, it seems to me like you should be able to just use what's embedded in the report, so I'm working on building my own dynamic report viewer. The first step is to parse the report and get the connection string and parameters out of it. In order to efficiently transfer the parameters and the connection string as a unit, I made two classes. One holds parameter info, the other holds connection string info PLUS a collection of parameters.
Saturday, February 4, 2012
Glimpses of Skiff: My Defense of Neuro-Diversity
Glimpses of Skiff: My Defense of Neuro-Diversity: I was running late as usual. I rushed into the meeting room, slightly out of breath, and found the closest chair. I sat back and obeserved...
Friday, February 3, 2012
SQLComplete is a great product
I have been using SQL Complete by dbForge for a couple years now, and I have to say - it is FANTASTIC! It speeds up my development time by at least double, and just generally takes the tedium out of typing in big scripts or debugging long old code written by others.
Download the free version here, tell 'em I sent ya!
http://www.devart.com/dbforge/sql/sqlcomplete/
Wednesday, October 5, 2011
Friday, April 15, 2011
Starting over
Well, I'm going to start over with my blog I think, switch to more of a technical diary of problems I encounter and how I solve them. Some of the stuff I want to document:
Have a dll that generates a 2d barcode image from text embedded into small report with one parameter for the text to encode. The report can be added as a subreport to other reports. (SQL Server Reporting Services)
Javascript I've been learning lately.. the cascading drop-downs is a good one
MVC website that takes pasted data from Excel in a textbox, converts it into a .NET datatable, then feeds the datatable as an object into a SQL Server 2008 stored procedure that is configured with a data valued parameter.
SSIS package that is dynamically configured for dev on local machine and prod on production machine using environment variables
SQL Script that searches all columns in all tables in all databases for specific text
Have a dll that generates a 2d barcode image from text embedded into small report with one parameter for the text to encode. The report can be added as a subreport to other reports. (SQL Server Reporting Services)
Javascript I've been learning lately.. the cascading drop-downs is a good one
MVC website that takes pasted data from Excel in a textbox, converts it into a .NET datatable, then feeds the datatable as an object into a SQL Server 2008 stored procedure that is configured with a data valued parameter.
SSIS package that is dynamically configured for dev on local machine and prod on production machine using environment variables
SQL Script that searches all columns in all tables in all databases for specific text
Saturday, November 8, 2008
Palin camp tries to squelch talk of infighting
HEADLINE IN RSS - Palin camp tries to squelch talk of infighting
HEADLINE IN STORY - Palin calls attacks 'cruel' and 'cowardly'
This is one of CNN's liberal slant things that annoys me.
Palin camp *tries to squelch* talk of infighting
tries to squelch
If it were a democrat the headline would be like:
"Attacks on Palin mean spirited"
When they report on republicans, cnn headlines promote their ideals with tone. Republicans "TRY" things where democrats "DO" them.
republicans are looked down on in pity when their down, and looked up to with animosity and hatred when their up. There is never a "just the facts" approach. There is ALWAYS an undercurrent.
I know so many people that dismiss FoxNews because it's a conservative news source.. now I'm talking about hard core conservatives thinking this, not left wingers! Poeple just accept the mainstays as valid and dismiss radio and conservatives as political hacks.
We seriously need to promote our own ideas and those who espouse them. We conservatives pride ourselves on our basic live and let live philosophy, but it's destroying our way of life in the face of the "make them do it our way or destroy them" militant organized liberal militia. Liberals are spreading their disease intentionally to the young in schools and colleges and in childrens TV shows and movies. We sit back and say "let people believe what they want".
We don't need to tell people what to do like they do. We just need to stop allowing them to determine which pieces of information are considered "facts" and which ones are "rumors" and "disinformation". We need to get the word out there what conservative beliefs are and teach our children.. no our neighbors children.. all children.. what socialism is, and capitalism, and marxism, and fascism, and communism.
Children should be getting an education inour schools! first second third grade is not a bad time to teach world history and political definitions and economic basic.. I teach it to my kids.. explain taxes (the daddy tax is applied to every happy meal, and I'm getting fat because of it! 8^) what better representation of the state of our government!)
Welp, my wife's wanting me to go make breakfast like I promised.
Have fun all!
Usarian
HEADLINE IN STORY - Palin calls attacks 'cruel' and 'cowardly'
This is one of CNN's liberal slant things that annoys me.
Palin camp *tries to squelch* talk of infighting
tries to squelch
If it were a democrat the headline would be like:
"Attacks on Palin mean spirited"
When they report on republicans, cnn headlines promote their ideals with tone. Republicans "TRY" things where democrats "DO" them.
republicans are looked down on in pity when their down, and looked up to with animosity and hatred when their up. There is never a "just the facts" approach. There is ALWAYS an undercurrent.
I know so many people that dismiss FoxNews because it's a conservative news source.. now I'm talking about hard core conservatives thinking this, not left wingers! Poeple just accept the mainstays as valid and dismiss radio and conservatives as political hacks.
We seriously need to promote our own ideas and those who espouse them. We conservatives pride ourselves on our basic live and let live philosophy, but it's destroying our way of life in the face of the "make them do it our way or destroy them" militant organized liberal militia. Liberals are spreading their disease intentionally to the young in schools and colleges and in childrens TV shows and movies. We sit back and say "let people believe what they want".
We don't need to tell people what to do like they do. We just need to stop allowing them to determine which pieces of information are considered "facts" and which ones are "rumors" and "disinformation". We need to get the word out there what conservative beliefs are and teach our children.. no our neighbors children.. all children.. what socialism is, and capitalism, and marxism, and fascism, and communism.
Children should be getting an education inour schools! first second third grade is not a bad time to teach world history and political definitions and economic basic.. I teach it to my kids.. explain taxes (the daddy tax is applied to every happy meal, and I'm getting fat because of it! 8^) what better representation of the state of our government!)
Welp, my wife's wanting me to go make breakfast like I promised.
Have fun all!
Usarian
Town stunned as 8-year-old charged in two killings
Town stunned as 8-year-old charged in two killings
This doesn't even sadden me. It's horrible what they're doing to this kid. They take a little child, put him in a room and start asking him questions. Of COURSE he's going to say he did it!!
I have five boys. 8 year olds are smart, yes. But they're small children just the same. They have absolutely NO concept of what they're doing. It is simply not possible for this child to have hatched this evil plan in his little head and carried it out!
Physically.. handguns kick back when you pull the trigger. They tip up toward the ceiling. If he hit ANYthing, it would have been a lucky strike.
This whole situation is beyond absurdity.
Look, I'm not saying the kid didn't do it, but they should have been a whole lot more careful in handling the kid and making sure he was comfortable and properly represented. Jumping to conclusions so quickly is just wrong.
This doesn't even sadden me. It's horrible what they're doing to this kid. They take a little child, put him in a room and start asking him questions. Of COURSE he's going to say he did it!!
I have five boys. 8 year olds are smart, yes. But they're small children just the same. They have absolutely NO concept of what they're doing. It is simply not possible for this child to have hatched this evil plan in his little head and carried it out!
Physically.. handguns kick back when you pull the trigger. They tip up toward the ceiling. If he hit ANYthing, it would have been a lucky strike.
This whole situation is beyond absurdity.
Look, I'm not saying the kid didn't do it, but they should have been a whole lot more careful in handling the kid and making sure he was comfortable and properly represented. Jumping to conclusions so quickly is just wrong.
Subscribe to:
Posts (Atom)