Cannot get datagrid to display data 
July 11th, 2008, 10:45 PM
| | | |
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> | 
July 14th, 2008, 01:45 PM
| | | | 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>
>
>
>
| | 
July 14th, 2008, 07:35 PM
| | | | 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 | 
July 14th, 2008, 08:15 PM
| | | | 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
| | 
July 14th, 2008, 11:20 PM
| | | | 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
| | |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 225,662 network members.
|