Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Sunday, August 17, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: Display Excel into Datagrid.
Gaurang
Posts: 34
 
Display Excel into Datagrid.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Jan 09 1:13 AM
Hi... all.........

I am trying to read data from excel file and display it into the datagrid without existance of any table in the Database...!

I am able to dispaly colums in the grid by following code...


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open ("D:\Licence1.xls")

intRow = 1
intCol = 1

Do Until objExcel.Cells(1,intCol).Value = ""
intCol = intCol + 1
Loop

Do Until objExcel.Cells(intRow,1).Value = ""
intRow = intRow + 1
Loop

for i=1 to intCol-1
Set col = Datagrid1.Columns.Add(0)

col.FieldName = objExcel.Cells(1,i).Value 'DNL
col.Caption = objExcel.Cells(1,i).Value
col.Width = 100
col.ReadOnly = True
col.DisableEditor = True

next
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Datagrid1.Columns.Add(0) ---- this property is present for column but not add row.

I have tried following code to add row....!!


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set objTravelRS = DataGrid1.Recordset
objTravelRS.AddNew ---------------- > (error : "Object Required-objTravelRS")
objTravelRS.Fields("Column1").Value = "TestValue"
DataGrid1.Recordset = objTravelRS

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Is there any other way I can do it...??

---------
Regards
Gaurang.

[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: Display Excel into Datagrid.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Jan 09 9:46 AM
Yuk, what an unpleasant requirement.

You are trying to walk before you can run. First objective is to get your Excel data into a recordset - I suggest you focus on that bit initially and stop worrying about datagrids until afterwards. If you search the Internet, you will find examples of how to do this. If your spreadsheet is large, this may not be very fast. If you could read instead from a CSV file, it would be quite a bit simpler.

Then build your datagrid columns dynamically using the same fieldnames and datatypes as you have in your Excel spreadsheet.

Then SET the recordset of the dg to be the same as the recordset you have just read.

Then dg.Refresh.

Not tried it, but that is the direction I would head in.

Phil

-- Morning-After Edit-- eek: "Walk before you can run" !!! In future, maybe I should not type posts when I am tired.
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 8/17/2025 4:17:22 AM