Belinda
Belinda

Reputation: 116

How to Load Data from Sql Sever 2014 to VS2008 Smart Device Application .sdf File?

I have a project VS 2008 SmartDevice Application. There DBFile is created and my dbFile name is .DBFile.sdf with 3 tables. I need to update the table with values of another table in sql server 2014. I used XML File to load the table.

XML File Code : D:/Import.XML *

<?xml version='1.0'?>
<Items>
 <Item> 
    <CustCode>G0014</CustCode>
    <InDocketRef>030073</InDocketRef>   
    <ImportDate>2023-01-10T00:00:00</ImportDate>    
    <UniqueCode>8888</UniqueCode>
    <unit>CTN</unit>
  </Item>
  <Item>
    <CustCode>G0014</CustCode>
    <InDocketRef>030073</InDocketRef>   
    <ImportDate>2023-01-10T00:00:00</ImportDate>   
    <UniqueCode></UniqueCode>
    <unit></unit>
  </Item></Items>

in my .cs file i used the below code:

DataSet ds = new DataSet();
  ds.ReadXml(@"D:\Import.XML");
  DataTable table = new DataTable();
  table = ds.Tables[0];
  dataGrid1.DataSource = table;

but it throws the error:

Could not find a part of a path. But the path is correct.

Anyone please help to fix this issue? please suggest if there is any better way to connect with Sql server 2014 to retrieve the data.

Upvotes: 0

Views: 50

Answers (0)

Related Questions