Showing posts with label appear. Show all posts
Showing posts with label appear. Show all posts

Saturday, March 31, 2012

System.IndexOutOfRangeException

I'm seeing the above error message appear on a web form. All the formcode-behind does is grab data from a SQL Server db (2005 Beta) andwrite it out in specfied controls.
The line that throws up the error is the following:
<code>
Line 150: txtCoDeath1a.Text = dtr("COD1a")
</code>
'Dtr' is simply a datareader that has been initialised previously. Iknow I should be checking for nulls in the db, but that isn't theproblem in this instant as the record I'm grabbing does have data forthe field 'COD1a'. It's of type nvarchar, length 150.
I've googled this error and have not found anything that seems directly relevant.
I'm using VB.
Any help much appreciated.

try putting this before your code

if dtr.Read then
dtr("COD1a")
end if


Sorry Chris, I should've posted more of my code.
I already have those lines in the code.
Any other ideas?

Try this

if not System.DBNull(dtr("COD1a")) then

txtCoDeath1a.Text = dtr("COD1a")

end if

Could you post more of your code? Are results coming back from the database? Is there a field called COD1a?


Thanks for the help guys, but I've located the source of theproblem. Very simple; I'd misnamed 'Cod1a'. Its actually 'CodIa'. Spotthe difference? Neither did I for a while!
<Sheepish> Sorry and thanks again.

Monday, March 26, 2012

System.NET.Mail and Outlook

Is there any way that I can use the System.NET.Mail classes to send an
email so that the sent emails appear in the Sent Email folder in
Outlook for the email address of the person that I am sending the email
fromyou'd have to use the outlook object to do that
<anewell@.valassis.co.uk> wrote in message
news:1151492707.136477.166730@.x69g2000cwx.googlegroups.com...
> Is there any way that I can use the System.NET.Mail classes to send an
> email so that the sent emails appear in the Sent Email folder in
> Outlook for the email address of the person that I am sending the email
> from
>
It would also have to be done on the client, not on the server.
HTH,
Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist
Big thicks are made up of lots of little thins.
"Smokey Grindle" <nospamhere@.dontspam.net> wrote in message
news:e$5CuEsmGHA.3980@.TK2MSFTNGP02.phx.gbl...
> you'd have to use the outlook object to do that
> <anewell@.valassis.co.uk> wrote in message
> news:1151492707.136477.166730@.x69g2000cwx.googlegroups.com...
>

System.NET.Mail and Outlook

Is there any way that I can use the System.NET.Mail classes to send an
email so that the sent emails appear in the Sent Email folder in
Outlook for the email address of the person that I am sending the email
fromyou'd have to use the outlook object to do that

<anewell@.valassis.co.uk> wrote in message
news:1151492707.136477.166730@.x69g2000cwx.googlegr oups.com...
> Is there any way that I can use the System.NET.Mail classes to send an
> email so that the sent emails appear in the Sent Email folder in
> Outlook for the email address of the person that I am sending the email
> from
It would also have to be done on the client, not on the server.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.

"Smokey Grindle" <nospamhere@.dontspam.net> wrote in message
news:e$5CuEsmGHA.3980@.TK2MSFTNGP02.phx.gbl...
> you'd have to use the outlook object to do that
> <anewell@.valassis.co.uk> wrote in message
> news:1151492707.136477.166730@.x69g2000cwx.googlegr oups.com...
>> Is there any way that I can use the System.NET.Mail classes to send an
>> email so that the sent emails appear in the Sent Email folder in
>> Outlook for the email address of the person that I am sending the email
>> from
>>