April 2005 - Posts - Derek Adkins

April 2005 - Posts

Casting dates

I have a question about converting "CCYYMMDD" to "DD MONTH CCYY"

For example:  "20050426" would become  "26 April 2005"

dim str1 as string = "20050426"
str1 = 
CDate(str1).ToLongDateString

It seems right to me, but I get an exception:  Cast from string "20060331" to type 'Date' is not valid.

Any ideas?  I'm certain I'm overlooking something really simple.

powered by IMHO 1.2

Posted 26 April 2005 02:06 PM by derek | 2 comment(s)
Filed under:
The Commentator

My brother pointed me to this:  Very useful software.  With lots of options to suit everyone's taste.

Commentator

powered by IMHO 1.2

Beginner webservice question

I have a question that I'm posting up here because I think the answers should "hopefully" be of use to other developers.

I want to retrieve a customer record from the database through a webservice.  Then make changes to the data, and update it back to the database also via a webservice.

Now I can easily do this with 2 separate functions, one that accepts the customer ID as a input parm and returns the record in a dataset.  The second accepts the dataset as input parm and returns a boolean for success/not.

But is there not a better way?

powered by IMHO 1.2

Posted 20 April 2005 10:18 AM by derek | 3 comment(s)
Filed under:
Converting DataReader to a Dataset

I found this article on how to convert a DataReader to a Dataset.  In case you ever want to do such a thing.  Maybe for serialisation through web services ... I dunno.

Converting DataReader to DataSet

I was going to use this in my application, but I found an alternate solution using a normal DataAdapter with a AS/400 stored procedure.   But I still think it's an interesting piece of code regardless.

powered by IMHO 1.2

Posted 15 April 2005 04:01 PM by derek | 2 comment(s)
Filed under:
I hate how paging works in a datagrid... so...

Yesterday, a good friend of mine showed me a neat trick when dealing with a datagrid.  (Or any repeatable object for that matter.)

Enclose your datagrid in a DIV tag with overflow set to auto.  Try it... You'll like it.

<div style="BORDER-RIGHT: 2px inset; BORDER-TOP: 2px inset; OVERFLOW: auto; BORDER-LEFT: 2px inset; WIDTH: 499px; BORDER-BOTTOM: 2px inset; HEIGHT: 200px" align="left">
    <asp:datagrid 
id="dgCu... etc.etc
    <
/asp:datagrid>
<
/div>

 

Oh, and remember to set the paging on the datagrid properties OFF!

The only negative thing is that for datagrids with lots of rows, it takes a while to load.


 

powered by IMHO 1.2

Posted 13 April 2005 09:16 AM by derek | 1 comment(s)
Filed under:
MCAD and holiday

Well, I haven't posted anything in a long time, so I think an update is in order.  On the 17th March, I passed 70-310, and am now MCAD.NET!!! YAY!  Only 2 more and my MCSD is in sight.  I'm quite excited about it because I've been studying for these exams for it seems like forever already!

On other news, we just had a fantastic 2 week holiday in Cape Town, and Kyron got to see her great grandmother who lives in Gordon's Bay.  We spent the 2 weeks just driving round, taking in the sights and things.  And just relaxing.  It was great to get away from the work pressure for a while.

Now back at work, I'm picking up where I left off with the Customer Online system in VB.NET.  I've already got 2 webservices written that validate users against AS/400 user profiles, and a second webservice that fetches customer details based on authority levels set up against the user profile on the AS/400.  So things are progressing...

powered by IMHO 1.2