Spire.XLS for .NET is a professional Excel .NET library that can be used to any type of .NET( C#, VB.NET, ASP.NET, .NET Core) application, both ASP.NET web sites and Windows Forms application.

Mon Sep 19, 2011 11:46 am

Using LINQ to SQL
Hello,
I want to work with the grid of Janusys GridEX and export data in the grid. I also use Linq to Sql els as a container for data.

Here is my code
Dim workbook As Workbook = New Workbook()
Dim sheet As Worksheet = workbook.Worksheets(0)
sheet.InsertDataTable(CType(Me.GridEX1.DataSource, DataTable), True, 2, 1, -1, -1)


Here's my mistake

" Unable to cast object of type 'System.Data.Linq.DataQuery `1 [CAND_LANDI.wAdresseSelect]' to type 'System.Data.DataTable'."

Can you help me, thank you in advance.

Guy Muller

gmuller@vonet.ch
 
Posts: 8
Joined: Wed Mar 23, 2011 10:58 am

Tue Sep 20, 2011 6:24 am

Sorry for late reply
There is a way of LINQ Query to DataTable. You can have a try:
Code: Select all
Dim dataTable as DataTable = Me.GridEX1.DataSource.CopyToDataTable()
sheet.InsertDataTable(dataTable, True, 2, 1, -1, -1)

Also, you can get helps from this article http://msdn.microsoft.com/en-us/library/bb386921.aspx.
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Tue Sep 20, 2011 9:43 am

Hello, thank you for your message, but your link is valid for frm4.0 and I use the 3.5. For LINQ to SQL object, CopyToDataTable () is not applicable.

If you have any other information, it is again!
Saluations

gmuller@vonet.ch
 
Posts: 8
Joined: Wed Mar 23, 2011 10:58 am

Wed Sep 21, 2011 7:54 am

Thank you for your inquiry

If you want to convert Linq query to DataTable in frm3.5, we provide you with a demo by attachment, you can have a try. We implement a simple method CopyToDataTable.
Attachments
LoadProtectionFile(9-20).zip
(9.52 KiB) Downloaded 428 times
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Thu Sep 22, 2011 4:16 pm

Hello,
The example that is on schedule to open a file with a password.

Can you post an example with the method and CopyToDataTable Linq query to a DataTable in frm3.5.

Thank you in advance.
greetings
Guy Muller

gmuller@vonet.ch
 
Posts: 8
Joined: Wed Mar 23, 2011 10:58 am

Fri Sep 23, 2011 1:31 am

hello,

Sorry for my mistake,and i will send you the demo with attachment. You can have a try. If you still have any problem, please contact us
Sorry again.
Attachments
Country.zip
(3.1 KiB) Downloaded 439 times
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Fri Sep 23, 2011 1:54 pm

Hi, this is a good example,
Unfortunately, I develop in Vb.net and I can not get the cod in C + +,

If you have a moment to convert it, it would be very useful.

Thank you in advance,

Guy Muller

gmuller@vonet.ch
 
Posts: 8
Joined: Wed Mar 23, 2011 10:58 am

Mon Sep 26, 2011 2:57 am

Hello,Guy Muller

Thank you for you patience with our reply
I will send you the demo in VB.net by attachment, please have a try. If you still have any question, please contact us.
Attachments
LinkToDatatable-VB.zip
(3.32 KiB) Downloaded 421 times
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Thu Sep 29, 2011 9:55 am

Hello,
I tried to take the code, but it does not work well, I'm very busy these days I'll look at the code when I am calmer!

Thank you for your shipment and availability

Greetings Guy Muller

gmuller@vonet.ch
 
Posts: 8
Joined: Wed Mar 23, 2011 10:58 am

Fri Sep 30, 2011 4:09 am

Hello,Guy Muller

Thank you for patience with our reply.

if still have any questions after you trying, Please do not hesitate to contact us. We will keep track of your question

Thanks and Regards
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Fri Sep 30, 2011 4:20 am

Hello,Guy Muller
Sorry for any inconveniences caused by us.

If you have tried the code and it does not work well In your environment. Would you please make a specific description under it to help us better to produce it?

Thanks and Regards
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Return to Spire.XLS