Connecting Tech Pros Worldwide Forums | Help | Site Map

Cannot get datagrid to display data

=?Utf-8?B?VG9yZW4gVmFsb25l?=
Guest
 
Posts: n/a
#1: Jul 11 '08
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>




=?Utf-8?B?am1zaWRlcw==?=
Guest
 
Posts: n/a
#2: Jul 14 '08

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>
>
>
>
=?Utf-8?B?VG9yZW4gVmFsb25l?=
Guest
 
Posts: n/a
#3: Jul 14 '08

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
=?Utf-8?B?am1zaWRlcw==?=
Guest
 
Posts: n/a
#4: Jul 14 '08

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
=?Utf-8?B?VG9yZW4gVmFsb25l?=
Guest
 
Posts: n/a
#5: Jul 14 '08

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