Developer Forum [ All Topics | New Topic ]

Thread: how to dispaly data in grid

how can i show my inventory in datagrid by using web service


>> add a comment
rajesh
07/16/2010 05:39


3 Replies:

which servirce are you trying to use?


>> add a comment
Ahaliav
7/18/2010 8:51:00 AM
https://technet.rapaport.com/webservices/Upload/DiamondManager.asmx
i used this web service every thing working perfect in vb.net 2008
you have any code in C# or Vb.Net so we can see our data .

when we upload data

UploadManager.ReplaceAll = False

this is right option when we add new inventory



>> add a comment
rajesh
7/23/2010 11:08:00 AM

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

>> add a comment
Ahaliav
7/25/2010 2:33:00 AM