473,803 Members | 3,857 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cannot get datagrid to display data

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()
{
InitializeCompo nent();

XmlDataDocument xmlDatadoc = new XmlDataDocument ();
xmlDatadoc.Data Set.ReadXml("vr database.xml");
DataSet ds = new DataSet("vrdata DataSet");
ds = xmlDatadoc.Data Set;
dataGridView1.D ataSource = ds.DefaultViewM anager;
}

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_creatio n_date>
</record_creation _date>
<citation_numbe r>33</citation_number >
<date_vr_inquir y_sent_to_dmv>0 7072008</date_vr_inquiry _sent_to_dmv>
<vr_inquiry_rec eived_from_dmv>
</vr_inquiry_rece ived_from_dmv>
<vin_number>
</vin_number>
<as_of_date>999 999 </as_of_date>
<file_code>
</file_code>
<model_year>
</model_year>
<make>
</make>
<experation_yea r>
</experation_year >
<paper_issued_d ate>
</paper_issued_da te>
<name_address_d ata>
<ro_name_addres s_source_indica tor>
</ro_name_address _source_indicat or>
<ro_name>
</ro_name>
<ro_address>
</ro_address>
<ro_city>
</ro_city>
<ro_county_code >
</ro_county_code>
<new_owner_addr ess_or_message>
</new_owner_addre ss_or_message>
<new_owner_city _state_or_messa ge>
</new_owner_city_ state_or_messag e>
</name_address_da ta>
<release_of_lia bility_date>
</release_of_liab ility_date>
<transfer_date_ or_message>
</transfer_date_o r_message>
<new_owner_name _or_message>
</new_owner_name_ or_message>
<record_id>
</record_id>
<errors>
<error_code_7 6>
</error_code_76>
<error_date_7 6>
</error_date_76>
<error_code_70_ 71_77>
</error_code_70_7 1_77>
<error_date_70_ 71_77>
</error_date_70_7 1_77>
</errors>
</inquiry_data>
<parking_hold >
<date_to_dmv>
</date_to_dmv>
<type_action_co de>
</type_action_cod e>
<dispostion_cod e>
</dispostion_code >
<citation_numbe r>
</citation_number >
<violation_date >
</violation_date>
<penalty_amount >
</penalty_amount>
<notice_date>
</notice_date>
<citation_paid_ date>
</citation_paid_d ate>
</parking_hold>
</vr_record>
</vrdatabase>

Jul 11 '08 #1
4 1972
I think there is something wrong with your XML.

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

GridView1.DataS ource = ds; //.DefaultViewMan ager;
GridView1.DataB ind();
"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()
{
InitializeCompo nent();

XmlDataDocument xmlDatadoc = new XmlDataDocument ();
xmlDatadoc.Data Set.ReadXml("vr database.xml");
DataSet ds = new DataSet("vrdata DataSet");
ds = xmlDatadoc.Data Set;
dataGridView1.D ataSource = ds.DefaultViewM anager;
}

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_creatio n_date>
</record_creation _date>
<citation_numbe r>33</citation_number >
<date_vr_inquir y_sent_to_dmv>0 7072008</date_vr_inquiry _sent_to_dmv>
<vr_inquiry_rec eived_from_dmv>
</vr_inquiry_rece ived_from_dmv>
<vin_number>
</vin_number>
<as_of_date>999 999 </as_of_date>
<file_code>
</file_code>
<model_year>
</model_year>
<make>
</make>
<experation_yea r>
</experation_year >
<paper_issued_d ate>
</paper_issued_da te>
<name_address_d ata>
<ro_name_addres s_source_indica tor>
</ro_name_address _source_indicat or>
<ro_name>
</ro_name>
<ro_address>
</ro_address>
<ro_city>
</ro_city>
<ro_county_code >
</ro_county_code>
<new_owner_addr ess_or_message>
</new_owner_addre ss_or_message>
<new_owner_city _state_or_messa ge>
</new_owner_city_ state_or_messag e>
</name_address_da ta>
<release_of_lia bility_date>
</release_of_liab ility_date>
<transfer_date_ or_message>
</transfer_date_o r_message>
<new_owner_name _or_message>
</new_owner_name_ or_message>
<record_id>
</record_id>
<errors>
<error_code_7 6>
</error_code_76>
<error_date_7 6>
</error_date_76>
<error_code_70_ 71_77>
</error_code_70_7 1_77>
<error_date_70_ 71_77>
</error_date_70_7 1_77>
</errors>
</inquiry_data>
<parking_hold >
<date_to_dmv>
</date_to_dmv>
<type_action_co de>
</type_action_cod e>
<dispostion_cod e>
</dispostion_code >
<citation_numbe r>
</citation_number >
<violation_date >
</violation_date>
<penalty_amount >
</penalty_amount>
<notice_date>
</notice_date>
<citation_paid_ date>
</citation_paid_d ate>
</parking_hold>
</vr_record>
</vrdatabase>
Jul 14 '08 #2


"jmsides" wrote:
I think there is something wrong with your XML.

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

GridView1.DataS ource = ds; //.DefaultViewMan ager;
GridView1.DataB ind();
"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()
{
InitializeCompo nent();

XmlDataDocument xmlDatadoc = new XmlDataDocument ();
xmlDatadoc.Data Set.ReadXml("vr database.xml");
DataSet ds = new DataSet("vrdata DataSet");
ds = xmlDatadoc.Data Set;
dataGridView1.D ataSource = ds.DefaultViewM anager;
}

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_creatio n_date>
</record_creation _date>
<citation_numbe r>33</citation_number >
<date_vr_inquir y_sent_to_dmv>0 7072008</date_vr_inquiry _sent_to_dmv>
<vr_inquiry_rec eived_from_dmv>
</vr_inquiry_rece ived_from_dmv>
<vin_number>
</vin_number>
<as_of_date>999 999 </as_of_date>
<file_code>
</file_code>
<model_year>
</model_year>
<make>
</make>
<experation_yea r>
</experation_year >
<paper_issued_d ate>
</paper_issued_da te>
<name_address_d ata>
<ro_name_addres s_source_indica tor>
</ro_name_address _source_indicat or>
<ro_name>
</ro_name>
<ro_address>
</ro_address>
<ro_city>
</ro_city>
<ro_county_code >
</ro_county_code>
<new_owner_addr ess_or_message>
</new_owner_addre ss_or_message>
<new_owner_city _state_or_messa ge>
</new_owner_city_ state_or_messag e>
</name_address_da ta>
<release_of_lia bility_date>
</release_of_liab ility_date>
<transfer_date_ or_message>
</transfer_date_o r_message>
<new_owner_name _or_message>
</new_owner_name_ or_message>
<record_id>
</record_id>
<errors>
<error_code_7 6>
</error_code_76>
<error_date_7 6>
</error_date_76>
<error_code_70_ 71_77>
</error_code_70_7 1_77>
<error_date_70_ 71_77>
</error_date_70_7 1_77>
</errors>
</inquiry_data>
<parking_hold >
<date_to_dmv>
</date_to_dmv>
<type_action_co de>
</type_action_cod e>
<dispostion_cod e>
</dispostion_code >
<citation_numbe r>
</citation_number >
<violation_date >
</violation_date>
<penalty_amount >
</penalty_amount>
<notice_date>
</notice_date>
<citation_paid_ date>
</citation_paid_d ate>
</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.d atabindings
Jul 14 '08 #3
http://msdn.microsoft.com/en-us/libr...6d(VS.80).aspx

"Toren Valone" wrote:
>

"jmsides" wrote:
I think there is something wrong with your XML.

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

GridView1.DataS ource = ds; //.DefaultViewMan ager;
GridView1.DataB ind();
"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()
{
InitializeCompo nent();
>
XmlDataDocument xmlDatadoc = new XmlDataDocument ();
xmlDatadoc.Data Set.ReadXml("vr database.xml");
DataSet ds = new DataSet("vrdata DataSet");
ds = xmlDatadoc.Data Set;
dataGridView1.D ataSource = ds.DefaultViewM anager;
}
>
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_creatio n_date>
</record_creation _date>
<citation_numbe r>33</citation_number >
<date_vr_inquir y_sent_to_dmv>0 7072008</date_vr_inquiry _sent_to_dmv>
<vr_inquiry_rec eived_from_dmv>
</vr_inquiry_rece ived_from_dmv>
<vin_number>
</vin_number>
<as_of_date>999 999 </as_of_date>
<file_code>
</file_code>
<model_year>
</model_year>
<make>
</make>
<experation_yea r>
</experation_year >
<paper_issued_d ate>
</paper_issued_da te>
<name_address_d ata>
<ro_name_addres s_source_indica tor>
</ro_name_address _source_indicat or>
<ro_name>
</ro_name>
<ro_address>
</ro_address>
<ro_city>
</ro_city>
<ro_county_code >
</ro_county_code>
<new_owner_addr ess_or_message>
</new_owner_addre ss_or_message>
<new_owner_city _state_or_messa ge>
</new_owner_city_ state_or_messag e>
</name_address_da ta>
<release_of_lia bility_date>
</release_of_liab ility_date>
<transfer_date_ or_message>
</transfer_date_o r_message>
<new_owner_name _or_message>
</new_owner_name_ or_message>
<record_id>
</record_id>
<errors>
<error_code_7 6>
</error_code_76>
<error_date_7 6>
</error_date_76>
<error_code_70_ 71_77>
</error_code_70_7 1_77>
<error_date_70_ 71_77>
</error_date_70_7 1_77>
</errors>
</inquiry_data>
<parking_hold >
<date_to_dmv>
</date_to_dmv>
<type_action_co de>
</type_action_cod e>
<dispostion_cod e>
</dispostion_code >
<citation_numbe r>
</citation_number >
<violation_date >
</violation_date>
<penalty_amount >
</penalty_amount>
<notice_date>
</notice_date>
<citation_paid_ date>
</citation_paid_d ate>
</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.d atabindings
Jul 14 '08 #4
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.datab ind().

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

"Toren Valone" wrote:


"jmsides" wrote:
I think there is something wrong with your XML.
>
Try this change and see if it leads you in the right direction?
>
GridView1.DataS ource = ds; //.DefaultViewMan ager;
GridView1.DataB ind();
>
>
"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()
{
InitializeCompo nent();

XmlDataDocument xmlDatadoc = new XmlDataDocument ();
xmlDatadoc.Data Set.ReadXml("vr database.xml");
DataSet ds = new DataSet("vrdata DataSet");
ds = xmlDatadoc.Data Set;
dataGridView1.D ataSource = ds.DefaultViewM anager;
}

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_creatio n_date>
</record_creation _date>
<citation_numbe r>33</citation_number >
<date_vr_inquir y_sent_to_dmv>0 7072008</date_vr_inquiry _sent_to_dmv>
<vr_inquiry_rec eived_from_dmv>
</vr_inquiry_rece ived_from_dmv>
<vin_number>
</vin_number>
<as_of_date>999 999 </as_of_date>
<file_code>
</file_code>
<model_year>
</model_year>
<make>
</make>
<experation_yea r>
</experation_year >
<paper_issued_d ate>
</paper_issued_da te>
<name_address_d ata>
<ro_name_addres s_source_indica tor>
</ro_name_address _source_indicat or>
<ro_name>
</ro_name>
<ro_address>
</ro_address>
<ro_city>
</ro_city>
<ro_county_code >
</ro_county_code>
<new_owner_addr ess_or_message>
</new_owner_addre ss_or_message>
<new_owner_city _state_or_messa ge>
</new_owner_city_ state_or_messag e>
</name_address_da ta>
<release_of_lia bility_date>
</release_of_liab ility_date>
<transfer_date_ or_message>
</transfer_date_o r_message>
<new_owner_name _or_message>
</new_owner_name_ or_message>
<record_id>
</record_id>
<errors>
<error_code_7 6>
</error_code_76>
<error_date_7 6>
</error_date_76>
<error_code_70_ 71_77>
</error_code_70_7 1_77>
<error_date_70_ 71_77>
</error_date_70_7 1_77>
</errors>
</inquiry_data>
<parking_hold >
<date_to_dmv>
</date_to_dmv>
<type_action_co de>
</type_action_cod e>
<dispostion_cod e>
</dispostion_code >
<citation_numbe r>
</citation_number >
<violation_date >
</violation_date>
<penalty_amount >
</penalty_amount>
<notice_date>
</notice_date>
<citation_paid_ date>
</citation_paid_d ate>
</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.d atabindings
Jul 14 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4237
by: Andrew S. Giles | last post by:
Hello, I am importing a flat text file, and putting it into a datagrid for display on a form. Currently the users have their dates and times seperated. I have two fields, therefore in the datatable feeding the datagrid control. Both are of the DateTime Type. How do I get the time field to display only the Time, and not the date, which is apparently the default.
3
3007
by: Doug | last post by:
Hi I have the following code (not mine) that populates a datagrid with some file names. But I want to replace the datagrid with a combo box. private void OnCurrentDataCellChanged(object sender, System.EventArgs e) {try{ DataSet ds = dgMembers.DataSource as DataSet;
5
12242
by: John Richardson | last post by:
I've been bothered for some time about my DataGrid not populating my rows very quickly. I have about 10K rows loading into the grid. I create a datatable dt with 2 columns, an ID and a display. The ID is a member of the keys array. I then create a DataView dv over the table, and sort it by Display and ID column (in case of duplicate Display). I then set my DataGrid.DataSource = dv; I then load the datatable with my rows, and this is...
12
2013
by: Daniel Walzenbach | last post by:
Hi, I want to display a Label in a DataGrid according to some condition. I therefore check whether the condition is true in the ItemDateBound EventHandler of the DataGrid. Unfortunately the conversion is extremely costly in performance. Does anybody know how I could set the label (of the whole content of the TableCell) to .Visible = False without converting e.Item.Controls(2) to a System.Web.UI.WebControls.Label?
7
1790
by: CanoeGuy | last post by:
I have been trying for the last two weeks to display a dynamic DataGrid. The data that I'm pulling from a SQL Server DB will have whole columns that will be either NULL or 0. I want to display only the fields that have actual data in them and either not display or hide the columns that have NULL or 0 values. As an example, one page may need to display a total of 5 columns and another page may need to display three columns based on the...
4
3236
by: hope | last post by:
Hi, How can I format a string field using Data Formatting Expression property in datagrid? For example: format last name from BROWN to Brown. Thanks
7
15444
by: Juan Romero | last post by:
Hey guys, please HELP I am going nuts with the datagrid control. I cannot get the damn control to refresh. I am using soap to get information from a web service. I have an XML writer output the file to a folder, and then I read it back into the dataset using the dataset1.readxml. Up to this point, everything works wonderfully. The query executes, the dataset gets populated, and I get the results displayed in the datagrid.
1
1248
by: jwogick | last post by:
I'm hoping someone can help me! I just have a simple form with a datagrid displaying child records from a dataset that contains two related tables Parent table>Clients Child table>cases. using the designer I tell the datagrid to display the child records only from the dataset (Relation called ClientsCases table>cases) it will display the data fine but when I add a new tablestyle with custom columns it does not change the columns in the...
7
3229
by: julian.tklim | last post by:
Hi, I need to build an editable Datagrid with add & delete buttons on each row using javascript. DataGrid need not be pre-populated with values. To make the thing complicated, one of the column need to be a date picker field. I know things will be easier with ASPX datagrid.
2
1784
tjc0ol
by: tjc0ol | last post by:
Hi guys, Im just wondering that I cannot update my database throught datagrid datalist control, and the only thing works is that I can delete, cancel, edit but when I clicked update link there's an error that says: "Syntax error in UPDATE statement." I wonder what's wrong with my code and how to correct this one? Below are my codes: OleDbConnection objConn = new OleDbConnection( "Provider=Microsoft.Jet.OleDb.4.0;" + "Data...
0
10310
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9121
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7603
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5498
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.