Excecl using asp.net- how can i select the column i wanna display?

Hi guy,
i have some problem here.
i cannot select the column i want to display?
using ORDER BY, is it wrong?
how should i do it?
below is my coding.

Dim Fle As String = "C:\Inetpub\wwwroot\ExcelData.xls"
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & Fle _
& ";" & "Extended Properties=Excel 8.0;" ' HDR=YES" 'IMEX=1"

Response.ContentType = "text/xml"
Response.Expires = -1
Response.Buffer = True

Dim myDataAdapter As New OleDbDataAdapter("SELECT * FROM [Sheet2$] ORDER BY SchID, SchDetail, SchDate, SchTime, SchVenue", strConn)
myDataAdapter.Fill(myDataset)
Dim s_Row As String

For Each myRow In myDataset.Tables(0).Rows
'Empty string
s_Row = String.Empty

For i As Int16 = 0 To DataType.SchID - 1 ' myRow.ItemArray.Length
'Is empty column detected in source file
If myRow.IsNull(i) = True Then
If myRow.IsNull(0) = True Then Exit For
Exit For
End If
s_Row += myRow(i).ToString + ","
Next
Response.Write(s_Row)
Next

I am not clear about your problem.

1. Do you use Aspose.Cells?

2. Where do you display the data, in MS Excel or web pages?

3. What do you mean "i cannot select the column i want to display?"?

Oo.. sorry i display my date on a ip phone.

that why i using (response.write)

btw thanks, i got my problem slove le.

now i having another problem.

i wan to display the data from excel by calling each individe row.

like using of special ID . but i cannot understand how am i going to do tat.

can givem e some ideal or some sample.?

thanks so much..

bang

Since you want to display your Excel file on an IP phone, I think you don't use Aspose.Cells at all.

I am not clear about your need and I don't know anything about IP phone so I don't know how I can help you.

hi laurence,

Mm.. dont care about the ip phone.
i wanna find a way to grab individe ROW of data from excel using asp.net or vb.net then put into a string or something i can print out alter using (response.write)

btw, thanks so much for ur time. Smile [:)]

To retrieve data from Excel files, Aspose.Cells is your best choice.

For example, to get data from the first row:

int maxColumn = workbook.Worksheets[0].Cells.MaxDataColumn;

for(int i = 0; i < maxColumn; i ++)

{

string data = workbook.Worksheets[0].Cells[0, i].StringValue;

//.....

}

hi,

sorry i dont really understand wat it mean..

i`m very new to asp.net.

so if i wan to call row 5, do i need to hav a special ID in my excel file? some thing like access

Are you using Aspose.Cells?

If yes, please check Developers Guide for Aspose.Cells for .NET

And you can check the demos source code after you install Aspose.Cells setup msi.

Generally you don’t need any special ID.

hi,

do u mean i need to install the software or a msi be4 i can make it work?

Yes. Please download and try latest Aspose.Cells at the following link:
Aspose.Cells for .NET (Latest Version)