Showing posts with label write. Show all posts
Showing posts with label write. Show all posts

Saturday, March 31, 2012

There is no position at row 0

Hi:

I am getting this error when a transaction needs to write to the Database after the user clicks the submit button.

Any help on what is the cause is greatly appreciated.

Thanks in advance for your help.It's impossible to answer this without seeing some code and also the eventual stored procedure you are using to execute the transaction.
************* Edited by moderator Adec ***************
Inserted missing < code></ code> tags. Always include such
tags when including code in your postings. Many readers
disregard postings without the code tags.
**************************************************

Thanks. Here is the situation. I am updating a site which was given to me, and fairly new to .net. I am competent to decifer the situation with the help by a person who knows.
Now correct me if I am wrong. I see that it is going to write the transaction to a table called 'Transactions'. I'm looking at the table in the DB and the fields do not look like the fields it is looking for below. Now I am assuming that I should change the fields in this code to match exactly what is in the table. Also the fields in the table do not have the letters in front of the field name. Ex: iUserID, dtDateTime. It has UserID, DateTime.. etc. what are the letters in front for? Also the last line of this code, should there be a table called PublicPayInvoice created in the DB, because I don't see it. Not sure if that is the table it is looking for.

Thanks

The Code:


'Write the Transaction
If sX_Response_Code = "1" Then
Transactions.WriteTransaction(iUSerID, dtDateTime, iAccountID, sTransactionType, sMethod, sRecipientEmail, _
sx_Email, "YES", "NO", sX_Response_Code, sX_Response_Subcode, _
sX_Response_Reason_Code, sX_Response_Reason_Text, _
sX_Auth_Code, sX_AVS_Code, sX_Trans_ID, sX_Description, dProcessing, _
dTransactionFee, dChargeBackFee, dRefundFee, dPremiereFee, dRequestedAmount, _
dX_Amount, sIP, "PP")
Else
If sX_Auth_Code = "" Then
sX_Auth_Code = "0"
End If

Transactions.WriteTransaction(iUSerID, dtDateTime, iAccountID, sTransactionType, sMethod, sRecipientEmail, _
sx_Email, "NO", "YES", sX_Response_Code, sX_Response_Subcode, _
sX_Response_Reason_Code, sX_Response_Reason_Text, _
sX_Auth_Code, sX_AVS_Code, sX_Trans_ID, sX_Description, dProcessing, _
dTransactionFee, dChargeBackFee, dRefundFee, dPremiereFee, dRequestedAmount, _
dX_Amount, sIP, "PP")
End If
'Get the TransactionID
iTransactionID = Transactions.GetPublicTransactionID(iUSerID, sRecipientEmail, sx_Email)

Dim sTo As String
Dim sFrom As String
Dim sSubject As String
Dim sBody As String
Dim mail As New MailMessage()
Dim iTemp As Integer

If sX_Response_Code = 1 Then
Transactions.PublicPayInvoice(iUSerID, sCustomerInvoivceNum, iTransactionID, sTransactionType, sMethod, _
Left(Session.Contents.Item("x_Card_Num"), 4) & "-XXXX-XXXX-" _
& Right(Session.Contents.Item("x_Card_Num"), 4), sExpDate, _
Session.Contents.Item("x_Card_Code"), Session.Contents.Item(" _
"x_bank_Name"), Left(Session.Contents.Item("x_Bank_Acct_Num"), 2) _
& "XXXXXXXXXXXXXX" & Right(Session.Contents.Item("x_Bank_Acct_Num"), 4), _
Session.Contents.Item("x_Bank_ABA_Code"), sFirstName & " " & sLastName, _
sAddress, sCity, sState, sZip, sCountry, sCardType)


You are using an own Class called Transactions here. What do the methods from that Class used here look like?
The class is to long to post here for you to look at. Can I email it to you?
Firstly, sharpening up your communication skills would be a great help. How do you expect us to know what is going on if you don't give us the appropriate information? For example, what is the error that you talked about in your first post!?!

Secondly, the additional "letters in front of the field name" are simply a naming convention and relate to the ID of the Controls/Varaibles that you are using.

Thirdly (to reiterate Andre's point), Transaction is actually an Object (an instantiated Class) and isn't a table in the database.

Finally, PublicPayInvoice is a method of the Invoice Object, not another table.

> I am competent to decifer the situation with the help by a person who knows
Evidently not!!
WoW. Thanks for being so CRUEL!
I was just thinking the same about2flip thing after reading the post from stevenbey.

Its amazing why some tech's get a bad wrap for having god-like complex's, lol. Dealing with people (or answering forums) this guy should not!!!
>>Dealing with people (or answering forums) this guy should not!!!

There are many who would disagree (i.e. those people who's problems I have solved).

Wednesday, March 28, 2012

Third Level Domain And ASP.NET 2.0

I need to write and test a new ASP.NET 2.0 application that uses third level
domains, like test.MyDomainName.Com. I just cannot figure out how to get the
new development server to allow this, if its even possible.

I have already tried http://test.localhost:2600/NewProject/Index.aspx, and
it does not like that. Then I added test.localhost to my host file to resolve
to 127.0.0.1 and tried the same URL again and it works, but ASP code of
Request.Url.Host only returns localhost. I have poked all around in the
properties in the request object as well as the request.url object and cannot
find anywhere were its picking up my domain prefix.

Anyone dealt with this before?

Thx in advance!

RossWhat you need to do is run a DNS server on your development server's box,
configure your test subdomain, and use IIS instead of VS 2005's internal server.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Ross Nornes" <RossNornes@.discussions.microsoft.comwrote in message
news:69D28053-658E-41F6-B778-D4BD2FFAD1E8@.microsoft.com...

Quote:

Originally Posted by

>I need to write and test a new ASP.NET 2.0 application that uses third level
domains, like test.MyDomainName.Com. I just cannot figure out how to get the
new development server to allow this, if its even possible.
>
I have already tried http://test.localhost:2600/NewProject/Index.aspx, and
it does not like that. Then I added test.localhost to my host file to resolve
to 127.0.0.1 and tried the same URL again and it works, but ASP code of
Request.Url.Host only returns localhost. I have poked all around in the
properties in the request object as well as the request.url object and cannot
find anywhere were its picking up my domain prefix.
>
Anyone dealt with this before?
>
Thx in advance!
>
Ross


Cool, thx for the reply Juan!

I figured it out now. People dont call these "third level domains" like I
do, I guess the more common term is "subdomain". :-) Go figure... Found lots
more info on Google after figuring that out...

Between your response and a few reponses to the subdomain google queries I
did, I took a little more simplistic approach since I did not want stand up a
DNS server on my box.

For anyone else wanting a solution, what I did was setup the Windows XP IIS
default website to point at my new ASP.NET 2.0 website I'm developing, I
edited my host file and created domains in there like test1.localhost.com,
test2.localhost.com and pointed them all at 127.0.0.1, then set up these test
subdomains as host headers in the default IIS website and bingo, I have a
functional test enviorment!

Thx!

Ross

"Juan T. Llibre" wrote:

Quote:

Originally Posted by

What you need to do is run a DNS server on your development server's box,
configure your test subdomain, and use IIS instead of VS 2005's internal server.
>
>
>
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espa?ol : http://asp.net.do/foros/
===================================
"Ross Nornes" <RossNornes@.discussions.microsoft.comwrote in message
news:69D28053-658E-41F6-B778-D4BD2FFAD1E8@.microsoft.com...

Quote:

Originally Posted by

I need to write and test a new ASP.NET 2.0 application that uses third level
domains, like test.MyDomainName.Com. I just cannot figure out how to get the
new development server to allow this, if its even possible.

I have already tried http://test.localhost:2600/NewProject/Index.aspx, and
it does not like that. Then I added test.localhost to my host file to resolve
to 127.0.0.1 and tried the same URL again and it works, but ASP code of
Request.Url.Host only returns localhost. I have poked all around in the
properties in the request object as well as the request.url object and cannot
find anywhere were its picking up my domain prefix.

Anyone dealt with this before?

Thx in advance!

Ross


>
>
>

Thursday, March 22, 2012

Thought For a Monday

A human being should be able to change a diaper, plan an invasion,
butcher a hog, conn a ship, design a building, write a sonnet, balance
accounts, build a wall, set a bone, comfort the dying, take orders,
give orders, cooperate, act alone, solve equations, analyze a new
problem, pitch manure, program a computer, cook a tasty meal, fight
efficiently, die gallantly.

Specialization is for insects.

-- RobertHeinlein, writing specialist

--
Scott
http://www.OdeToCode.com/blogs/scott/

--
Scott
http://www.OdeToCode.com/blogs/scott/Specialization is what makes societies great.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Scott Allen" <scott@.nospam.odetocode.com> wrote in message
news:gti151h1ra85vg72o9pdjhb0ak9jnal98l@.4ax.com...
>A human being should be able to change a diaper, plan an invasion,
> butcher a hog, conn a ship, design a building, write a sonnet, balance
> accounts, build a wall, set a bone, comfort the dying, take orders,
> give orders, cooperate, act alone, solve equations, analyze a new
> problem, pitch manure, program a computer, cook a tasty meal, fight
> efficiently, die gallantly.
> Specialization is for insects.
> -- RobertHeinlein, writing specialist
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
A nice description of what web programming is all about.

Eliyahu

"Scott Allen" <scott@.nospam.odetocode.com> wrote in message
news:gti151h1ra85vg72o9pdjhb0ak9jnal98l@.4ax.com...
> A human being should be able to change a diaper, plan an invasion,
> butcher a hog, conn a ship, design a building, write a sonnet, balance
> accounts, build a wall, set a bone, comfort the dying, take orders,
> give orders, cooperate, act alone, solve equations, analyze a new
> problem, pitch manure, program a computer, cook a tasty meal, fight
> efficiently, die gallantly.
> Specialization is for insects.
> -- RobertHeinlein, writing specialist
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
Sounds like a T-Cell. However, it should be noted that, while all T-Cells
start out the same, they eventually specialize. Why should an organization
composed of such cells behave any differently? For that matter, why isn't
the entire earth filled with amoebas?

I love Robert Heinlein. But, like Albert Einstein, he was only a man, and
not always right.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Scott Allen" <scott@.nospam.odetocode.com> wrote in message
news:gti151h1ra85vg72o9pdjhb0ak9jnal98l@.4ax.com...
>A human being should be able to change a diaper, plan an invasion,
> butcher a hog, conn a ship, design a building, write a sonnet, balance
> accounts, build a wall, set a bone, comfort the dying, take orders,
> give orders, cooperate, act alone, solve equations, analyze a new
> problem, pitch manure, program a computer, cook a tasty meal, fight
> efficiently, die gallantly.
> Specialization is for insects.
> -- RobertHeinlein, writing specialist
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
specialization is what allows a species to survive and excel in any
given ecosystem.

overspecialization in that same ecology makes them vulnerable to
significant shifts in the supporting systems.

where does that leave .net programmers? ;-)

david
specialization is what allows a species to survive and excel in any
given ecosystem.

overspecialization in that same ecology makes them vulnerable to
significant shifts in the surrounding and supporting systems.

where does that leave .net programmers? ;-)

(a colleague just told me she firmly believes that cobal programmers
will always have a job in the financial industry because those
mainframe systems and archives are so data-intensive that there is no
business case - read garunteed ROI - for changing the codebase.)

david
> where does that leave .net programmers? ;-)

Nowhere in particular, since there are all kinds of .Net programmers.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"David Alpert" <david@.spinthemoose.com> wrote in message
news:69c7e56f.0504041019.4505a517@.posting.google.c om...
> specialization is what allows a species to survive and excel in any
> given ecosystem.
> overspecialization in that same ecology makes them vulnerable to
> significant shifts in the supporting systems.
> where does that leave .net programmers? ;-)
> david
Sure..those that use C# and those that use VB.Net :)

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:u4wHChUOFHA.2144@.TK2MSFTNGP09.phx.gbl...
> > where does that leave .net programmers? ;-)
> Nowhere in particular, since there are all kinds of .Net programmers.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> What You Seek Is What You Get.
> "David Alpert" <david@.spinthemoose.com> wrote in message
> news:69c7e56f.0504041019.4505a517@.posting.google.c om...
> > specialization is what allows a species to survive and excel in any
> > given ecosystem.
> > overspecialization in that same ecology makes them vulnerable to
> > significant shifts in the supporting systems.
> > where does that leave .net programmers? ;-)
> > david
Very funny, Karl ;-P

--
;-),

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Karl Seguin" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:uJ0L36UOFHA.2736@.TK2MSFTNGP09.phx.gbl...
> Sure..those that use C# and those that use VB.Net :)
> Karl
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/ - New and Improved (yes, the popup is
> annoying)
> http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
> come!)
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:u4wHChUOFHA.2144@.TK2MSFTNGP09.phx.gbl...
>> > where does that leave .net programmers? ;-)
>>
>> Nowhere in particular, since there are all kinds of .Net programmers.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> .Net Developer
>> What You Seek Is What You Get.
>>
>> "David Alpert" <david@.spinthemoose.com> wrote in message
>> news:69c7e56f.0504041019.4505a517@.posting.google.c om...
>> > specialization is what allows a species to survive and excel in any
>> > given ecosystem.
>>> > overspecialization in that same ecology makes them vulnerable to
>> > significant shifts in the supporting systems.
>>> > where does that leave .net programmers? ;-)
>>> > david
>>
>>
And those who use JScript.NET, presumably,
not counting those who use Managed C++.

;-)

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Espaol
Ven, y hablemos de ASP.NET...
======================

"Karl Seguin" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:uJ0L36UOFHA.2736@.TK2MSFTNGP09.phx.gbl...
> Sure..those that use C# and those that use VB.Net :)
> Karl
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/ - New and Improved (yes, the popup is
> annoying)
> http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
> come!)
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:u4wHChUOFHA.2144@.TK2MSFTNGP09.phx.gbl...
>> > where does that leave .net programmers? ;-)
>>
>> Nowhere in particular, since there are all kinds of .Net programmers.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> .Net Developer
>> What You Seek Is What You Get.
>>
>> "David Alpert" <david@.spinthemoose.com> wrote in message
>> news:69c7e56f.0504041019.4505a517@.posting.google.c om...
>> > specialization is what allows a species to survive and excel in any
>> > given ecosystem.
>>> > overspecialization in that same ecology makes them vulnerable to
>> > significant shifts in the supporting systems.
>>> > where does that leave .net programmers? ;-)
>>> > david
>>
>>
What about all those Cobol.NET programmers out there?
;-)

--
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Juan T. Llibre" <nomailreplies@.nowhere.com> wrote in message
news:exqoNgVOFHA.3388@.TK2MSFTNGP10.phx.gbl...
> And those who use JScript.NET, presumably,
> not counting those who use Managed C++.
> ;-)
>
> Juan T. Llibre
> ASP.NET MVP
> http://asp.net.do/foros/
> Foros de ASP.NET en Espaol
> Ven, y hablemos de ASP.NET...
> ======================
> "Karl Seguin" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net>
> wrote in message news:uJ0L36UOFHA.2736@.TK2MSFTNGP09.phx.gbl...
>> Sure..those that use C# and those that use VB.Net :)
>>
>> Karl
>>
>> --
>> MY ASP.Net tutorials
>> http://www.openmymind.net/ - New and Improved (yes, the popup is
>> annoying)
>> http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
>> come!)
>> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
>> news:u4wHChUOFHA.2144@.TK2MSFTNGP09.phx.gbl...
>>> > where does that leave .net programmers? ;-)
>>>
>>> Nowhere in particular, since there are all kinds of .Net programmers.
>>>
>>> --
>>> HTH,
>>>
>>> Kevin Spencer
>>> Microsoft MVP
>>> .Net Developer
>>> What You Seek Is What You Get.
>>>
>>> "David Alpert" <david@.spinthemoose.com> wrote in message
>>> news:69c7e56f.0504041019.4505a517@.posting.google.c om...
>>> > specialization is what allows a species to survive and excel in any
>>> > given ecosystem.
>>>>> > overspecialization in that same ecology makes them vulnerable to
>>> > significant shifts in the supporting systems.
>>>>> > where does that leave .net programmers? ;-)
>>>>> > david
>>>
>>>
>>
>>
someone already mentioned overspecilization, didn't they? :)

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)

"Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
news:%23lSvnpVOFHA.2736@.TK2MSFTNGP09.phx.gbl...
> What about all those Cobol.NET programmers out there?
> ;-)
> --
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
> "Juan T. Llibre" <nomailreplies@.nowhere.com> wrote in message
> news:exqoNgVOFHA.3388@.TK2MSFTNGP10.phx.gbl...
> > And those who use JScript.NET, presumably,
> > not counting those who use Managed C++.
> > ;-)
> > Juan T. Llibre
> > ASP.NET MVP
> > http://asp.net.do/foros/
> > Foros de ASP.NET en Espaol
> > Ven, y hablemos de ASP.NET...
> > ======================
> > "Karl Seguin" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net>
> > wrote in message news:uJ0L36UOFHA.2736@.TK2MSFTNGP09.phx.gbl...
> >> Sure..those that use C# and those that use VB.Net :)
> >>
> >> Karl
> >>
> >> --
> >> MY ASP.Net tutorials
> >> http://www.openmymind.net/ - New and Improved (yes, the popup is
> >> annoying)
> >> http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
> >> come!)
> >> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> >> news:u4wHChUOFHA.2144@.TK2MSFTNGP09.phx.gbl...
> >>> > where does that leave .net programmers? ;-)
> >>>
> >>> Nowhere in particular, since there are all kinds of .Net programmers.
> >>>
> >>> --
> >>> HTH,
> >>>
> >>> Kevin Spencer
> >>> Microsoft MVP
> >>> .Net Developer
> >>> What You Seek Is What You Get.
> >>>
> >>> "David Alpert" <david@.spinthemoose.com> wrote in message
> >>> news:69c7e56f.0504041019.4505a517@.posting.google.c om...
> >>> > specialization is what allows a species to survive and excel in any
> >>> > given ecosystem.
> >>> >>> > overspecialization in that same ecology makes them vulnerable to
> >>> > significant shifts in the supporting systems.
> >>> >>> > where does that leave .net programmers? ;-)
> >>> >>> > david
> >>>
> >>>
> >>
> >>
Cobol.Net - For those of you who want to sit on the cutting edge in your
grandfather's rocking chair...

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Karl Seguin" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:uGjy1oWOFHA.440@.TK2MSFTNGP10.phx.gbl...
> someone already mentioned overspecilization, didn't they? :)
> Karl
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
> http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
> come!)
>
> "Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
> news:%23lSvnpVOFHA.2736@.TK2MSFTNGP09.phx.gbl...
>> What about all those Cobol.NET programmers out there?
>> ;-)
>>
>> --
>> Steve C. Orr, MCSD, MVP
>> http://SteveOrr.net
>>
>>
>> "Juan T. Llibre" <nomailreplies@.nowhere.com> wrote in message
>> news:exqoNgVOFHA.3388@.TK2MSFTNGP10.phx.gbl...
>> > And those who use JScript.NET, presumably,
>> > not counting those who use Managed C++.
>>> > ;-)
>>>>> > Juan T. Llibre
>> > ASP.NET MVP
>> > http://asp.net.do/foros/
>> > Foros de ASP.NET en Espaol
>> > Ven, y hablemos de ASP.NET...
>> > ======================
>>> > "Karl Seguin" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net>
>> > wrote in message news:uJ0L36UOFHA.2736@.TK2MSFTNGP09.phx.gbl...
>> >> Sure..those that use C# and those that use VB.Net :)
>> >>
>> >> Karl
>> >>
>> >> --
>> >> MY ASP.Net tutorials
>> >> http://www.openmymind.net/ - New and Improved (yes, the popup is
>> >> annoying)
>> >> http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
>> >> come!)
>> >> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
>> >> news:u4wHChUOFHA.2144@.TK2MSFTNGP09.phx.gbl...
>> >>> > where does that leave .net programmers? ;-)
>> >>>
>> >>> Nowhere in particular, since there are all kinds of .Net programmers.
>> >>>
>> >>> --
>> >>> HTH,
>> >>>
>> >>> Kevin Spencer
>> >>> Microsoft MVP
>> >>> .Net Developer
>> >>> What You Seek Is What You Get.
>> >>>
>> >>> "David Alpert" <david@.spinthemoose.com> wrote in message
>> >>> news:69c7e56f.0504041019.4505a517@.posting.google.c om...
>> >>> > specialization is what allows a species to survive and excel in any
>> >>> > given ecosystem.
>> >>>> >>> > overspecialization in that same ecology makes them vulnerable to
>> >>> > significant shifts in the supporting systems.
>> >>>> >>> > where does that leave .net programmers? ;-)
>> >>>> >>> > david
>> >>>
>> >>>
>> >>
>> >>
>>>>
>>

Thought For a Monday

A human being should be able to change a diaper, plan an invasion,
butcher a hog, conn a ship, design a building, write a sonnet, balance
accounts, build a wall, set a bone, comfort the dying, take orders,
give orders, cooperate, act alone, solve equations, analyze a new
problem, pitch manure, program a computer, cook a tasty meal, fight
efficiently, die gallantly.
Specialization is for insects.
-- RobertHeinlein, writing specialist
Scott
http://www.OdeToCode.com/blogs/scott/
Scott
http://www.OdeToCode.com/blogs/scott/Specialization is what makes societies great.
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Scott Allen" <scott@.nospam.odetocode.com> wrote in message
news:gti151h1ra85vg72o9pdjhb0ak9jnal98l@.
4ax.com...
>A human being should be able to change a diaper, plan an invasion,
> butcher a hog, conn a ship, design a building, write a sonnet, balance
> accounts, build a wall, set a bone, comfort the dying, take orders,
> give orders, cooperate, act alone, solve equations, analyze a new
> problem, pitch manure, program a computer, cook a tasty meal, fight
> efficiently, die gallantly.
> Specialization is for insects.
> -- RobertHeinlein, writing specialist
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
A nice description of what web programming is all about.
Eliyahu
"Scott Allen" <scott@.nospam.odetocode.com> wrote in message
news:gti151h1ra85vg72o9pdjhb0ak9jnal98l@.
4ax.com...
> A human being should be able to change a diaper, plan an invasion,
> butcher a hog, conn a ship, design a building, write a sonnet, balance
> accounts, build a wall, set a bone, comfort the dying, take orders,
> give orders, cooperate, act alone, solve equations, analyze a new
> problem, pitch manure, program a computer, cook a tasty meal, fight
> efficiently, die gallantly.
> Specialization is for insects.
> -- RobertHeinlein, writing specialist
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
Sounds like a T-Cell. However, it should be noted that, while all T-Cells
start out the same, they eventually specialize. Why should an organization
composed of such cells behave any differently? For that matter, why isn't
the entire earth filled with amoebas?
I love Robert Heinlein. But, like Albert Einstein, he was only a man, and
not always right.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
What You S Is What You Get.
"Scott Allen" <scott@.nospam.odetocode.com> wrote in message
news:gti151h1ra85vg72o9pdjhb0ak9jnal98l@.
4ax.com...
>A human being should be able to change a diaper, plan an invasion,
> butcher a hog, conn a ship, design a building, write a sonnet, balance
> accounts, build a wall, set a bone, comfort the dying, take orders,
> give orders, cooperate, act alone, solve equations, analyze a new
> problem, pitch manure, program a computer, cook a tasty meal, fight
> efficiently, die gallantly.
> Specialization is for insects.
> -- RobertHeinlein, writing specialist
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
specialization is what allows a species to survive and excel in any
given ecosystem.
overspecialization in that same ecology makes them vulnerable to
significant shifts in the supporting systems.
where does that leave .net programmers? ;-)
david
specialization is what allows a species to survive and excel in any
given ecosystem.
overspecialization in that same ecology makes them vulnerable to
significant shifts in the surrounding and supporting systems.
where does that leave .net programmers? ;-)
(a colleague just told me she firmly believes that cobal programmers
will always have a job in the financial industry because those
mainframe systems and archives are so data-intensive that there is no
business case - read garunteed ROI - for changing the codebase.)
david
> where does that leave .net programmers? ;-)
Nowhere in particular, since there are all kinds of .Net programmers.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
What You S Is What You Get.
"David Alpert" <david@.spinthemoose.com> wrote in message
news:69c7e56f.0504041019.4505a517@.posting.google.com...
> specialization is what allows a species to survive and excel in any
> given ecosystem.
> overspecialization in that same ecology makes them vulnerable to
> significant shifts in the supporting systems.
> where does that leave .net programmers? ;-)
> david
Sure..those that use C# and those that use VB.Net :)
Karl
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:u4wHChUOFHA.2144@.TK2MSFTNGP09.phx.gbl...
> Nowhere in particular, since there are all kinds of .Net programmers.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> What You S Is What You Get.
> "David Alpert" <david@.spinthemoose.com> wrote in message
> news:69c7e56f.0504041019.4505a517@.posting.google.com...
>
Very funny, Karl ;-P
;-),
Kevin Spencer
Microsoft MVP
.Net Developer
What You S Is What You Get.
"Karl Seguin" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:uJ0L36UOFHA.2736@.TK2MSFTNGP09.phx.gbl...
> Sure..those that use C# and those that use VB.Net :)
> Karl
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/ - New and Improved (yes, the popup is
> annoying)
> http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
> come!)
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:u4wHChUOFHA.2144@.TK2MSFTNGP09.phx.gbl...
>
And those who use JScript.NET, presumably,
not counting those who use Managed C++.
;-)
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Espaol
Ven, y hablemos de ASP.NET...
======================
"Karl Seguin" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:uJ0L36UOFHA.2736@.TK2MSFTNGP09.phx.gbl...
> Sure..those that use C# and those that use VB.Net :)
> Karl
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/ - New and Improved (yes, the popup is
> annoying)
> http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
> come!)
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:u4wHChUOFHA.2144@.TK2MSFTNGP09.phx.gbl...
>

Thread execution report?

Hi, I am creating a newsletter system, and in the webform used to write and
send the newsletter I use a thread that sends all the newsletters, so that
when I write the newsletter I don't need to wait for all the mails to be
delivered, but it's the thread I launch that is responsible for the delivery
.
My question is, is there a way to have a report of the status of the deliver
y?
Since HTTP is stateless, I don't think there is a simple way to do this,
since, after I send the email and my request ends, I no longer have a way to
communicate with the thread which is still running on the server to send the
emails.
Do you have any suggestion?
Simone BusoliHave it send you an email.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.
"Simone Busoli" <SimoneBusoli@.discussions.microsoft.com> wrote in message
news:B6C016E0-6099-4E60-9744-6BD7DEB0C06D@.microsoft.com...
> Hi, I am creating a newsletter system, and in the webform used to write
> and
> send the newsletter I use a thread that sends all the newsletters, so that
> when I write the newsletter I don't need to wait for all the mails to be
> delivered, but it's the thread I launch that is responsible for the
> delivery.
> My question is, is there a way to have a report of the status of the
> delivery?
> Since HTTP is stateless, I don't think there is a simple way to do this,
> since, after I send the email and my request ends, I no longer have a way
> to
> communicate with the thread which is still running on the server to send
> the
> emails.
> Do you have any suggestion?
> --
> Simone Busoli

Tuesday, March 13, 2012

Thread timeout

Hi,
I have a long running task that I want to run on a regular basis to do some
db updates. I can't write a windows service because it is being hosted
elsewhere. I want to run this task within my web application - so here is
what I did:
In the global.asax I declared a delegate function and a timer. In the
application start event, I started the timer. I created a method to
respond to the timer event, which creates a new thread and runs the Long
Running Task method:
Private Delegate Function LongRunningTaskTask() As Integer
Private WithEvents ServiceTimer As New System.Timers.Timer(86400000)
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
ServiceTimer.Start()
End Sub
Private Sub WakeUp(ByVal sender As Object, _
ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
Try
' Create new thread
Dim AsyncStatePrice As IAsyncResult
' Start the task on a runtime thread asynchronously
Dim AsyncInvokerPrice As New LongRunningTaskTask(AddressOf
LongRunningTaskUpdate)
AsyncStatePrice = AsyncInvokerPrice.BeginInvoke(Nothing,
Nothing)
Dim WaitHandles() As WaitHandle =
{AsyncStatePrice.AsyncWaitHandle}
WaitHandle.WaitAll(WaitHandles)
Catch ex As Exception
'Throw (ex)
End Try
End Sub
The method kicks off fine, but times-out before completion. I want this to
continue running regardless if the person who invoked the application start
event has their browser open or not. Is there a way to increase the
timeout value for the thread through code. I don't want to change the
session timeout for everyone, just this one process. Is there a better
solution?
Thanks
Message posted via http://www.webservertalk.comIt seems you have a long running task, but I don't see where the return
value comes into play.
This might not be the best solution for what you want, but it is something
else to consider. You could use the ThreadPool.QueueUserWorkItem method
that takes a WaitCallBack and an optional object parameter.
ApplicationStart
ThreadPool.QueueUserWorkItem( new WaitCallBack( LongRunningTask ) );
public static void LongRunningTask( object data )
{
//your long running task in here. If you need the user who kicked this off,
you can pass it
//through object data.
}
LongRunningTask will run in a thread from the ThreadPool that .NET
maintains. The timer event also runs from the thread pool. However, this
is a one time, queue this method and run it. It does not have to be a
static (shared) method, but mine typically are. If you need to do something
with the return value, I am sure you could come up with something, or not
even take this approach anyway.
Timers typically are used for recurring tasks, like checking application
state, processing a continuous queue. If you are merely running this task
"on occasion", it probably would be better served using the thread pool.
I just looked and you code is in VB, sorry about my samples.
HTH,
bill
"JeffSinNHUSA via webservertalk.com" <forum@.webservertalk.com> wrote in
message news:85011c9724d646de9be3606d4c960ba2@.Do
webservertalk.com...
> Hi,
> I have a long running task that I want to run on a regular basis to do
some
> db updates. I can't write a windows service because it is being hosted
> elsewhere. I want to run this task within my web application - so here is
> what I did:
> In the global.asax I declared a delegate function and a timer. In the
> application start event, I started the timer. I created a method to
> respond to the timer event, which creates a new thread and runs the Long
> Running Task method:
> Private Delegate Function LongRunningTaskTask() As Integer
> Private WithEvents ServiceTimer As New System.Timers.Timer(86400000)
>
> Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
> ServiceTimer.Start()
> End Sub
>
> Private Sub WakeUp(ByVal sender As Object, _
> ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
> Try
> ' Create new thread
> Dim AsyncStatePrice As IAsyncResult
> ' Start the task on a runtime thread asynchronously
> Dim AsyncInvokerPrice As New LongRunningTaskTask(AddressOf
> LongRunningTaskUpdate)
> AsyncStatePrice = AsyncInvokerPrice.BeginInvoke(Nothing,
> Nothing)
> Dim WaitHandles() As WaitHandle =
> {AsyncStatePrice.AsyncWaitHandle}
> WaitHandle.WaitAll(WaitHandles)
> Catch ex As Exception
> 'Throw (ex)
> End Try
> End Sub
>
> The method kicks off fine, but times-out before completion. I want this
to
> continue running regardless if the person who invoked the application
start
> event has their browser open or not. Is there a way to increase the
> timeout value for the thread through code. I don't want to change the
> session timeout for everyone, just this one process. Is there a better
> solution?
> Thanks
> --
> Message posted via http://www.webservertalk.com
Well, I tried the ThreadPool.QueueUserWorkItem approach, but it looks like
it terminates the thread after about 30 seconds.
Private WithEvents ServiceTimer As New System.Timers.Timer(600000)
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
ServiceTimer.Start()
End Sub
Private Sub PricePointsWakeUp(ByVal sender As Object, _
ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
Dim stateInfo As New TaskInfo("Price Points Update", 1)
If ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf
LongRunningTask), stateInfo) Then
Thread.Sleep(1000)
End If
End Sub
Public Class TaskInfo
Public Boilerplate As String
Public Value As Integer
Public Sub New(ByVal text As String, ByVal number As Integer)
Boilerplate = text
Value = number
End Sub
End Class
Shared Sub LongRunningTask(ByVal stateInfo As Object)
End Sub
Message posted via http://www.webservertalk.com
I did not realize you are wanting to fire your price point method every
600000. I thought you were wanting a queue that you could queue up long
running tasks, and use your timer to clear the queue. You can probably skip
the queue user work item since your timer is called from a thread in the
ThreadPool anyway. My mistake.
How do you know the thread is dying? Is it receiving a
ThreadAbortException. (that means the thread is timing out) or it is a Sql
timeout exception. If a Sql Timeout exception, you could increase the
CommandTimeout on your SqlCommand object.
If you are recieving the ThreadAbortException, you probably will have to
manually create a thread (not from the ThreadPool) to run the long running
task. Your timer shouldn't block waiting for it to complete, but probably
should fire the thread off and then return immediately.
If you need a sample to get a manually created thread off and running let me
know.
Sorry for misunderstanding you and basically giving you the run around. :)
bill
"JeffSinNHUSA via webservertalk.com" <forum@.webservertalk.com> wrote in
message news:4f599a23f948417db07f21a9143b623c@.Do
webservertalk.com...
> Well, I tried the ThreadPool.QueueUserWorkItem approach, but it looks
like
> it terminates the thread after about 30 seconds.
>
> Private WithEvents ServiceTimer As New System.Timers.Timer(600000)
> Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
> ServiceTimer.Start()
> End Sub
>
> Private Sub PricePointsWakeUp(ByVal sender As Object, _
> ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
> Dim stateInfo As New TaskInfo("Price Points Update", 1)
> If ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf
> LongRunningTask), stateInfo) Then
> Thread.Sleep(1000)
> End If
> End Sub
> Public Class TaskInfo
> Public Boilerplate As String
> Public Value As Integer
> Public Sub New(ByVal text As String, ByVal number As Integer)
> Boilerplate = text
> Value = number
> End Sub
> End Class
> Shared Sub LongRunningTask(ByVal stateInfo As Object)
> End Sub
> --
> Message posted via http://www.webservertalk.com
No problem on the advice - I learned something new.
So back to the old code. I threw try catch blocks around everything, and
instead of throwing an exception, I emailed myself the esception info. I
also email myself as it loops thru the data it is processing. After about
6 iterations (which takes about 60 seconds) I stop receiving emails. Looks
like an exception isn't being thrown.
Message posted via http://www.webservertalk.com

Thread timeout

Hi,

I have a long running task that I want to run on a regular basis to do some
db updates. I can't write a windows service because it is being hosted
elsewhere. I want to run this task within my web application - so here is
what I did:

In the global.asax I declared a delegate function and a timer. In the
application start event, I started the timer. I created a method to
respond to the timer event, which creates a new thread and runs the Long
Running Task method:

Private Delegate Function LongRunningTaskTask() As Integer
Private WithEvents ServiceTimer As New System.Timers.Timer(86400000)

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
ServiceTimer.Start()
End Sub

Private Sub WakeUp(ByVal sender As Object, _
ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
Try
' Create new thread
Dim AsyncStatePrice As IAsyncResult
' Start the task on a runtime thread asynchronously
Dim AsyncInvokerPrice As New LongRunningTaskTask(AddressOf
LongRunningTaskUpdate)

AsyncStatePrice = AsyncInvokerPrice.BeginInvoke(Nothing,
Nothing)

Dim WaitHandles() As WaitHandle =
{AsyncStatePrice.AsyncWaitHandle}
WaitHandle.WaitAll(WaitHandles)

Catch ex As Exception
'Throw (ex)
End Try
End Sub

The method kicks off fine, but times-out before completion. I want this to
continue running regardless if the person who invoked the application start
event has their browser open or not. Is there a way to increase the
timeout value for the thread through code. I don't want to change the
session timeout for everyone, just this one process. Is there a better
solution?

Thanks

--
Message posted via http://www.dotnetmonster.comIt seems you have a long running task, but I don't see where the return
value comes into play.

This might not be the best solution for what you want, but it is something
else to consider. You could use the ThreadPool.QueueUserWorkItem method
that takes a WaitCallBack and an optional object parameter.

ApplicationStart

ThreadPool.QueueUserWorkItem( new WaitCallBack( LongRunningTask ) );

public static void LongRunningTask( object data )
{
//your long running task in here. If you need the user who kicked this off,
you can pass it
//through object data.
}

LongRunningTask will run in a thread from the ThreadPool that .NET
maintains. The timer event also runs from the thread pool. However, this
is a one time, queue this method and run it. It does not have to be a
static (shared) method, but mine typically are. If you need to do something
with the return value, I am sure you could come up with something, or not
even take this approach anyway.

Timers typically are used for recurring tasks, like checking application
state, processing a continuous queue. If you are merely running this task
"on occasion", it probably would be better served using the thread pool.

I just looked and you code is in VB, sorry about my samples.

HTH,

bill

"JeffSinNHUSA via DotNetMonster.com" <forum@.DotNetMonster.com> wrote in
message news:85011c9724d646de9be3606d4c960ba2@.DotNetMonste r.com...
> Hi,
> I have a long running task that I want to run on a regular basis to do
some
> db updates. I can't write a windows service because it is being hosted
> elsewhere. I want to run this task within my web application - so here is
> what I did:
> In the global.asax I declared a delegate function and a timer. In the
> application start event, I started the timer. I created a method to
> respond to the timer event, which creates a new thread and runs the Long
> Running Task method:
> Private Delegate Function LongRunningTaskTask() As Integer
> Private WithEvents ServiceTimer As New System.Timers.Timer(86400000)
>
> Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
> ServiceTimer.Start()
> End Sub
>
> Private Sub WakeUp(ByVal sender As Object, _
> ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
> Try
> ' Create new thread
> Dim AsyncStatePrice As IAsyncResult
> ' Start the task on a runtime thread asynchronously
> Dim AsyncInvokerPrice As New LongRunningTaskTask(AddressOf
> LongRunningTaskUpdate)
> AsyncStatePrice = AsyncInvokerPrice.BeginInvoke(Nothing,
> Nothing)
> Dim WaitHandles() As WaitHandle =
> {AsyncStatePrice.AsyncWaitHandle}
> WaitHandle.WaitAll(WaitHandles)
> Catch ex As Exception
> 'Throw (ex)
> End Try
> End Sub
>
> The method kicks off fine, but times-out before completion. I want this
to
> continue running regardless if the person who invoked the application
start
> event has their browser open or not. Is there a way to increase the
> timeout value for the thread through code. I don't want to change the
> session timeout for everyone, just this one process. Is there a better
> solution?
> Thanks
> --
> Message posted via http://www.dotnetmonster.com
Well, I tried the ThreadPool.QueueUserWorkItem approach, but it looks like
it terminates the thread after about 30 seconds.

Private WithEvents ServiceTimer As New System.Timers.Timer(600000)

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
ServiceTimer.Start()
End Sub

Private Sub PricePointsWakeUp(ByVal sender As Object, _
ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
Dim stateInfo As New TaskInfo("Price Points Update", 1)
If ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf
LongRunningTask), stateInfo) Then

Thread.Sleep(1000)

End If
End Sub

Public Class TaskInfo
Public Boilerplate As String
Public Value As Integer

Public Sub New(ByVal text As String, ByVal number As Integer)
Boilerplate = text
Value = number
End Sub
End Class

Shared Sub LongRunningTask(ByVal stateInfo As Object)

End Sub

--
Message posted via http://www.dotnetmonster.com
I did not realize you are wanting to fire your price point method every
600000. I thought you were wanting a queue that you could queue up long
running tasks, and use your timer to clear the queue. You can probably skip
the queue user work item since your timer is called from a thread in the
ThreadPool anyway. My mistake.

How do you know the thread is dying? Is it receiving a
ThreadAbortException. (that means the thread is timing out) or it is a Sql
timeout exception. If a Sql Timeout exception, you could increase the
CommandTimeout on your SqlCommand object.

If you are recieving the ThreadAbortException, you probably will have to
manually create a thread (not from the ThreadPool) to run the long running
task. Your timer shouldn't block waiting for it to complete, but probably
should fire the thread off and then return immediately.

If you need a sample to get a manually created thread off and running let me
know.

Sorry for misunderstanding you and basically giving you the run around. :)

bill

"JeffSinNHUSA via DotNetMonster.com" <forum@.DotNetMonster.com> wrote in
message news:4f599a23f948417db07f21a9143b623c@.DotNetMonste r.com...
> Well, I tried the ThreadPool.QueueUserWorkItem approach, but it looks
like
> it terminates the thread after about 30 seconds.
>
> Private WithEvents ServiceTimer As New System.Timers.Timer(600000)
> Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
> ServiceTimer.Start()
> End Sub
>
> Private Sub PricePointsWakeUp(ByVal sender As Object, _
> ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
> Dim stateInfo As New TaskInfo("Price Points Update", 1)
> If ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf
> LongRunningTask), stateInfo) Then
> Thread.Sleep(1000)
> End If
> End Sub
> Public Class TaskInfo
> Public Boilerplate As String
> Public Value As Integer
> Public Sub New(ByVal text As String, ByVal number As Integer)
> Boilerplate = text
> Value = number
> End Sub
> End Class
> Shared Sub LongRunningTask(ByVal stateInfo As Object)
> End Sub
> --
> Message posted via http://www.dotnetmonster.com
No problem on the advice - I learned something new.

So back to the old code. I threw try catch blocks around everything, and
instead of throwing an exception, I emailed myself the esception info. I
also email myself as it loops thru the data it is processing. After about
6 iterations (which takes about 60 seconds) I stop receiving emails. Looks
like an exception isn't being thrown.

--
Message posted via http://www.dotnetmonster.com