Geeks With Blogs

News


Rodney Vinyard - .NET & SQL Developer When all is said and done, more will be said than done

       public string _LogString_ViaDataReader

        {

            get

            {

                string x = "";

                try

                {

                    DataTableReader reader = _dsMarkit_log.MARKIT_LOG.CreateDataReader();

 

                    StringBuilder sb = new StringBuilder();

                    while (reader.Read())

                    {

                        // Given a DataTableReader, display column names.

                        for (int i = 0; i < reader.FieldCount; i++)

                        {

                            sb.Append("\r\n" + reader.GetName(i) + ": ");

 

                            if (reader.IsDBNull(i))

                            {

                                sb.Append("<NULL>");

                            }

                            else

                            {

                                try

                                {

                                    sb.Append(reader.GetValue(i).ToString());

                                }

                                catch (InvalidCastException)

                                {

                                    sb.Append("<Invalid data type>");

                                }

                            }

                        }

                        sb.Append("\r\n");

                    }

 

                    x = sb.ToString();

                }

                catch (Exception e)

                {

                    string y = e.ToString();

                    System.Diagnostics.Debug.WriteLine(y);

                    throw e;

                }

                finally

                {

                }

                return x;

            }

        }

Posted on Wednesday, March 21, 2007 12:47 PM XML & Datasets | Back to top


Comments on this post: DataTable.DataTableReader example

# Links (3/21/2007)
Requesting Gravatar...
.NET **** PolyDictionary - put multiple types in a single dictionary without losing type safety. ****
Left by Member Blogs on Apr 25, 2007 9:44 PM

# re: DataTable.DataTableReader example
Requesting Gravatar...
Thanks for the post. It's very comprehensive and convincing. You certainly hit a bull's eye. I looked for this function so long.
Left by thesis writing on Jun 30, 2010 8:27 AM

# # re: DataTable.DataTableReader example
Requesting Gravatar...
Poochie everything you do is just mind blowing, you are good girl... I mean really good,did you draw those skulls on, did you ever decide to put up a video on the mink nails!
Left by cv writing service on Feb 17, 2011 11:31 AM

# # # re: DataTable.DataTableReader example
Requesting Gravatar...
The simplicity and fashionable design of coach handbag is the most vital factor that thousands of women are in deep lover with this brand. Now festivals are coming one after another.
Left by superior essays on Feb 21, 2011 9:32 AM

# re: DataTable.DataTableReader example
Requesting Gravatar...
oh.thanks a lot for this great example.
Left by ankle brace on Apr 07, 2011 4:33 AM

# re: DataTable.DataTableReader example
Requesting Gravatar...
How am I going to do the datable instruction? This is really awesome.
Left by red velvet ropes on Aug 05, 2011 12:03 AM

Your comment:
 (will show your gravatar)


Copyright © Rodney Vinyard | Powered by: GeeksWithBlogs.net