473,804 Members | 3,424 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parsing Issues

I have a program that runs as a windows service waking up at predefined
intervals to send out mails. Each mail is based on a template with tags to
replace with database data from that specific row (mail merge type of
operation). Every so often the parsing is only half-done; but I’ve seen the
parsing work fully some times. I was thinking it could be some kind of a
memory problem (there are a lot of string manipulations in the code) but
checked to find the server did have good amount of free memory available. Has
anyone come across such a problem? If so, was this problem circumvented and
how?

I am adding below code snippet of how I am accomplishing the same.
try
{
SqlConnection con = dbc.Connection;
SqlConnection con1 = dbc.Connection;
SqlCommand com = new SqlCommand("<db select for the master row>", con);
SqlCommand com1;
SqlDataReader sdr = com.ExecuteRead er();

while (sdr.Read())
{
string temp = shipmailtemplat e;

temp = temp.Replace("< #tagidentifier> ", sdr.GetSqlStrin g(3).ToString() );
….<more replacements such as above)

com1 = new SqlCommand("<db select for the detail row>", con1);

SqlDataReader sdr1 = com1.ExecuteRea der();
bool isrow = false;
while (sdr1.Read())
{
isrow = true;
iter = iter.Replace("< #tagidentifier> ", sdr1.GetSqlStri ng(0).ToString( ));
….<more replacements such as above)
}
sdr1.Close();

if (isrow)
{
<send mails out>
}
}
sdr.Close();
con1.Close();
con.Close();
}
catch (Exception ex)
{
WriteError(ex.T oString());
}

Nov 16 '05 #1
3 1220
Badri,

How does the "dbc.Connection " property behave? Does it always return
the same connection, or does it create a new connection each time it
is called? If it always returns the same connection, then this code
may be the source of your problems:

SqlConnection con = dbc.Connection;
SqlConnection con1 = dbc.Connection;

If dbc.Connection always returns the same connection, then con and
con1 both point to the same connection. SqlDataReader requires
exclusive access to a connection until it is closed.

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 16 '05 #2
Chris - Thx for your response; the dbc.Connection always returns a new
connection. The curious thing about this is that it sometimes is able to
parse even 250 mails successfully but other times it even fails with just 60
to 70 parsings. And out of these failures, 99% it does not retrieve the
detail records (the second SQL / inner loop) in spite of the bool variable
"isrow" being checked prior to sending out the mails and no exception is
thrown either.

thx

"Chris R. Timmons" wrote:
Badri,

How does the "dbc.Connection " property behave? Does it always return
the same connection, or does it create a new connection each time it
is called? If it always returns the same connection, then this code
may be the source of your problems:

SqlConnection con = dbc.Connection;
SqlConnection con1 = dbc.Connection;

If dbc.Connection always returns the same connection, then con and
con1 both point to the same connection. SqlDataReader requires
exclusive access to a connection until it is closed.

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/

Nov 16 '05 #3
"=?Utf-8?B?QmFkcmk=?=" <Ba***@discussi ons.microsoft.c om> wrote in
news:53******** *************** ***********@mic rosoft.com:
Chris - Thx for your response; the dbc.Connection always returns
a new connection. The curious thing about this is that it
sometimes is able to parse even 250 mails successfully but other
times it even fails with just 60 to 70 parsings. And out of
these failures, 99% it does not retrieve the detail records (the
second SQL / inner loop) in spite of the bool variable "isrow"
being checked prior to sending out the mails and no exception is
thrown either.


Badri,

The only other thing I can think of is the connection may be timing
out. You could try using DataSets instead of data readers. That
would reduce the time a connection remains open.

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2006
by: Walter Dörwald | last post by:
Hello all! I'm trying to parse broken HTML with several Python tools. Unfortunately none of them work 100% reliable. Problems are e.g. nested comments, bare "&" in URLs and "<" in text (e.g. "if foo < bar") etc. All of these pages can be displayed properly in a browser so why not reuse the parser in e.g. Mozilla? Is there any way to get proper XML out of Mozilla? Calling mozilla on the
9
2776
by: Thomas W | last post by:
I'm developing a web-application where the user sometimes has to enter dates in plain text, allthough a format may be provided to give clues. On the server side this piece of text has to be parsed into a datetime python-object. Does anybody have any pointers on this? Besides the actual parsing, my main concern is the different locale date formats and how to be able to parse those strange us-like "month/day/year" compared to the clever...
3
3509
by: Pir8 | last post by:
I have a complex xml file, which contains stories within a magazine. The structure of the xml file is as follows: <?xml version="1.0" encoding="ISO-8859-1" ?> <magazine> <story> <story_id>112233</story_id> <pub_name>Puleen's Publication</pub_name> <pub_code>PP</pub_code> <edition_date>20031201</edition_date>
9
1957
by: wardy | last post by:
I'm trying to undestand the impact of using content negotiation when rendering my Web pages to various different browsers as I would like to use the XHTML Strict DOCTYPE declaration. Reading the W3C guidelines, if I render as 'text/html' then there are some backward compatibility issues I need to worry about. Does this mean that the page must be rendered in one way if I use the "application/xhmlt+xml" content type and another if I use...
1
1894
by: sp | last post by:
i have an xml file (an rss file) <?xml version="1.0" ?> <rss version="2.0"> <channel> <title>CodeGuru.com</title> <link>http://www.codeguru.com/</link> <description>The number one developer site!</description> <language>en-us</language> <lastBuildDate>Mon, 13 Feb 2006 09:52:05 EST</lastBuildDate>
0
1037
by: cactus | last post by:
Eight years after the invention of XML, DOM and SAX, despite their respective issues, are still the mainstays of application developers. So is it the end of road for XML parsing innovation? The VTD-XML project team think not. We are proud to announce the availability of version 1.5 of VTD-XML, the next generation open-source XML parser that goes beyond DOM and SAX in terms of performance, memory
0
1205
by: Jarod_24 | last post by:
I've tried the WebBrowser in the System.Windows.Forms namespace, but it dosen't work when you instanciate an object from a class. It needs a Form to live in to work. My application allready has the ability to parse html. It send webrequests, get the html, extracts links, detects <base href=""> tags, <iframe>, <frame> tags and so on. The only problem is when the html contain loops, document.write() calls stuff defined in the Document...
4
2017
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. It is greatly appreciated. I am working with Plimus for licensing my software. I can communicate with the server and I'm getting responses in XML. My question is, the XML stream that's coming back is telling if it's a successful license registration, validation, too many installs etc. How do I capture that information and use in my logic? I tried:
1
2884
by: Philip Semanchuk | last post by:
On Oct 12, 2008, at 5:25 AM, S.Selvam Siva wrote: Selvam, You can try to find them yourself using string parsing, but that's difficult. The closer you want to get to "perfect" at finding URLs expressed in JS, the closer you'll get to rewriting a JS interpreter. For instance, this is not so hard to understand: "http://example.com/" but this is:
0
9577
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10569
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10325
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.