Connecting Tech Pros Worldwide Help | Site Map

Cannot get datagrid to display data

  #1  
Old July 11th, 2008, 10:45 PM
=?Utf-8?B?VG9yZW4gVmFsb25l?=
Guest
 
Posts: n/a
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>



  #2  
Old July 14th, 2008, 01:45 PM
=?Utf-8?B?am1zaWRlcw==?=
Guest
 
Posts: n/a

re: Cannot get datagrid to display data


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();


"Toren Valone" wrote:
Quote:
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>
>
>
>
  #3  
Old July 14th, 2008, 07:35 PM
=?Utf-8?B?VG9yZW4gVmFsb25l?=
Guest
 
Posts: n/a

re: Cannot get datagrid to display data




"jmsides" wrote:
Quote:
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();
>
>
"Toren Valone" wrote:
>
Quote:
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, I tried to do what you recommended, but where is the databind
property?
When I type into the IDE i only get dataGridView1.databindings
  #4  
Old July 14th, 2008, 08:15 PM
=?Utf-8?B?am1zaWRlcw==?=
Guest
 
Posts: n/a

re: Cannot get datagrid to display data


http://msdn.microsoft.com/en-us/libr...6d(VS.80).aspx



"Toren Valone" wrote:
Quote:
>
>
"jmsides" wrote:
>
Quote:
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();


"Toren Valone" wrote:
Quote:
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, I tried to do what you recommended, but where is the databind
property?
When I type into the IDE i only get dataGridView1.databindings
  #5  
Old July 14th, 2008, 11:20 PM
=?Utf-8?B?VG9yZW4gVmFsb25l?=
Guest
 
Posts: n/a

re: Cannot get datagrid to display data


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().



"jmsides" wrote:
Quote:
http://msdn.microsoft.com/en-us/libr...6d(VS.80).aspx
>
>
>
"Toren Valone" wrote:
>
Quote:


"jmsides" wrote:
Quote:
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();
>
>
"Toren Valone" wrote:
>
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, I tried to do what you recommended, but where is the databind
property?
When I type into the IDE i only get dataGridView1.databindings
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting a vb.net datagrid to excel Coleen answers 6 September 7th, 2006 09:05 PM
Can't get a my DataGrid to work .. I'm busted or its busted bob answers 1 February 14th, 2006 06:05 AM
should I bind datagrid to array or temporary dataset? AFN answers 3 November 18th, 2005 05:08 AM
Getting a DataGrid to flexibly display a DataView Robert answers 1 November 15th, 2005 05:43 PM