Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / July 2008

Tip: Looking for answers? Try searching our database.

Cannot get datagrid to display data

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Toren Valone - 11 Jul 2008 22:43 GMT
Hi, I have an XML file that I was hoping to use as a database
Here is the code that I have copied that should display the data

namespace File_Generation_System
{
   public partial class vrholds : Form
   {
       public vrholds()
       {
           InitializeComponent();

           XmlDataDocument xmlDatadoc = new XmlDataDocument();
           xmlDatadoc.DataSet.ReadXml("vrdatabase.xml");
           DataSet ds = new DataSet("vrdata DataSet");
           ds = xmlDatadoc.DataSet;
           dataGridView1.DataSource = ds.DefaultViewManager;
       }

But what I get is a blank square when my form loads. Here is the XML

<?xml version="1.0" encoding="utf-8"?>
<vrdatabase>
 <vr_record>
   <inquiry_data>
     <license_number>
     </license_number>
     <record_creation_date>
     </record_creation_date>
     <citation_number>33</citation_number>
     <date_vr_inquiry_sent_to_dmv>07072008</date_vr_inquiry_sent_to_dmv>
     <vr_inquiry_received_from_dmv>
     </vr_inquiry_received_from_dmv>
     <vin_number>
     </vin_number>
     <as_of_date>999999 </as_of_date>
     <file_code>
     </file_code>
     <model_year>
     </model_year>
     <make>
     </make>
     <experation_year>
     </experation_year>
     <paper_issued_date>
     </paper_issued_date>
     <name_address_data>
       <ro_name_address_source_indicator>
       </ro_name_address_source_indicator>
       <ro_name>
       </ro_name>
       <ro_address>
       </ro_address>
       <ro_city>
       </ro_city>
       <ro_county_code>
       </ro_county_code>
       <new_owner_address_or_message>
       </new_owner_address_or_message>
       <new_owner_city_state_or_message>
       </new_owner_city_state_or_message>
     </name_address_data>
     <release_of_liability_date>
     </release_of_liability_date>
     <transfer_date_or_message>
     </transfer_date_or_message>
     <new_owner_name_or_message>
     </new_owner_name_or_message>
     <record_id>
     </record_id>
     <errors>
       <error_code_76>
       </error_code_76>
       <error_date_76>
       </error_date_76>
       <error_code_70_71_77>
       </error_code_70_71_77>
       <error_date_70_71_77>
       </error_date_70_71_77>
     </errors>
   </inquiry_data>
   <parking_hold>
     <date_to_dmv>
     </date_to_dmv>
     <type_action_code>
     </type_action_code>
     <dispostion_code>
     </dispostion_code>
     <citation_number>
     </citation_number>
     <violation_date>
     </violation_date>
     <penalty_amount>
     </penalty_amount>
     <notice_date>
     </notice_date>
     <citation_paid_date>
     </citation_paid_date>
   </parking_hold>
 </vr_record>
</vrdatabase>
jmsides - 14 Jul 2008 13:35 GMT
I think there is something wrong with your XML.

Try this change and see if it leads you in the right direction?

      GridView1.DataSource = ds; //.DefaultViewManager;
      GridView1.DataBind();

> Hi, I have an XML file that I was hoping to use as a database
> Here is the code that I have copied that should display the data
[quoted text clipped - 96 lines]
>   </vr_record>
> </vrdatabase>
Toren Valone - 14 Jul 2008 19:33 GMT
> I think there is something wrong with your XML.
>
[quoted text clipped - 103 lines]
> >   </vr_record>
> > </vrdatabase>

JMsides, I tried to do what you recommended, but where is the databind
property?
When I type into the IDE i only get  dataGridView1.databindings
jmsides - 14 Jul 2008 20:10 GMT
http://msdn.microsoft.com/en-us/library/fkx0cy6d(VS.80).aspx

> > I think there is something wrong with your XML.
> >
[quoted text clipped - 107 lines]
> property?
> When I type into the IDE i only get  dataGridView1.databindings
Toren Valone - 14 Jul 2008 22:50 GMT
jmsides, thanks but I am not using a ASP page or server script, I am
importing those libraries and the VS2005 intellisense does not allow me to
use gridview1.databind().

 

> http://msdn.microsoft.com/en-us/library/fkx0cy6d(VS.80).aspx
>
[quoted text clipped - 109 lines]
> > property?
> > When I type into the IDE i only get  dataGridView1.databindings

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.