Hi
You can look at this: http://technet.rapaport.com/Info/LotUpload/SampleCode/webService_Example.aspx
And for getting the data in a DataGrid you can do this:
//get your entire inventory in RapNet
GetLotsResult lotsRes = webServiceManager.GetLots();
string FilePath = @"C:\tmp\MyRapnetStock.csv";
//save your data to the file
File.AppendAllText(FilePath, lotsRes.LotList);
//create schema.ini file so you will not have any problems with columns that contains numeric and text data
using (FileStream filestr = new FileStream(@"C:\tmp\schema.ini", FileMode.Create, FileAccess.Write))
{
using (StreamWriter writer = new StreamWriter(filestr))
{
writer.WriteLine("[" + System.IO.Path.GetFileName(FilePath) + "]");
writer.WriteLine("MaxScanRows=0");
writer.WriteLine("Format=CSVDelimited");
writer.Close();
writer.Dispose();
}
filestr.Close();
filestr.Dispose();
}
String sConnectionString = "Provider=Microsoft.Jet.OleDb.4.0; Data Source = " + System.IO.Path.GetDirectoryName(FilePath) + "; Extended Properties = \"text;HDR=YES;FMT=Delimited" + Convert.ToChar(34);
OleDbConnection conn = new OleDbConnection(sConnectionString);
DataTable tb = null;
conn.Open();
try
{
OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM " + System.IO.Path.GetFileName(FilePath), conn);
DataSet ds = new DataSet("Temp");
adapter.Fill(ds);
tb = ds.Tables[0];
}
catch
{
} hope this helped,
Ahaliav Fox
|