Click here to Skip to main content
16,006,001 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Login Pin
Sam Heller13-Nov-06 13:02
Sam Heller13-Nov-06 13:02 
GeneralRe: Login Pin
Not Active13-Nov-06 16:10
mentorNot Active13-Nov-06 16:10 
QuestionASP.Net 1.1 with AJAX Pin
madnar13-Nov-06 6:55
madnar13-Nov-06 6:55 
AnswerRe: ASP.Net 1.1 with AJAX Pin
indianet13-Nov-06 8:03
indianet13-Nov-06 8:03 
GeneralRe: ASP.Net 1.1 with AJAX Pin
Sam Heller13-Nov-06 12:51
Sam Heller13-Nov-06 12:51 
QuestionCatching Embedded Events Pin
Sam Heller13-Nov-06 6:07
Sam Heller13-Nov-06 6:07 
AnswerRe: Catching Embedded Events Pin
indianet13-Nov-06 8:14
indianet13-Nov-06 8:14 
QuestionCreate DataGrid from Excel File Pin
alexfromto13-Nov-06 5:59
alexfromto13-Nov-06 5:59 
Hi.

Last week I posted a question regarding reading Excel file and loading it into the DataGrid.
I didn't get any useful response back so please forgive me for posting this second time.
I'm sure someone had the same problem I have.

I have 3 columns in Excel. One of the columns (User Id) has text data (like: User 1) or a number data (like: 12345). My code works and doesn't throw any error but for some reason it only extracts text data. The numbers are missing and I'm not sure why. I've tried to foramt that columnt to TEXT only but it doesn't help. Just to be sure I looped through DataSet to make sure the values are there and of course they weren't.

Here's the code that reads Excel and loads data into DataGrid. Please help.

Thank you.

Try<br />
            'Create DataSet and DataAdapter<br />
            ds = New System.Data.DataSet<br />
            da = New System.Data.OleDb.OleDbDataAdapter<br />
<br />
            'Establish connection<br />
            con = New System.Data.OleDb.OleDbConnection( _<br />
             "provider=Microsoft.Jet.OLEDB.4.0; " & _<br />
             "data source=" & Session("ExcelFilePath").ToString() & "; " & _<br />
             "Extended Properties=Excel 8.0")<br />
<br />
            'Create command<br />
            cmdSelectExcel = New System.Data.OleDb.OleDbCommand("SELECT * FROM [Sheet1$] ORDER BY Company", con)<br />
<br />
            'Open connection<br />
            con.Open()<br />
<br />
            'Exectue command through adapter<br />
            da.SelectCommand = cmdSelectExcel<br />
            da.Fill(ds, "[Sheet1$]")<br />
<br />
            'Assign DataSourse of the DataGrid and bind it<br />
            dg.DataSource = ds.Tables(0).DefaultView<br />
            dg.DataBind()<br />
<br />
            'Close Connection<br />
            con.Close()<br />
        Catch ex As Exception<br />
            'Display error message<br />
            lblError.Text = "Error: " & ex.ToString()<br />
            lblError.Visible = True<br />
        End Try

AnswerRe: Create DataGrid from Excel File Pin
Sam Heller13-Nov-06 6:10
Sam Heller13-Nov-06 6:10 
GeneralRe: Create DataGrid from Excel File Pin
alexfromto13-Nov-06 6:16
alexfromto13-Nov-06 6:16 
GeneralRe: Create DataGrid from Excel File Pin
Sam Heller13-Nov-06 12:48
Sam Heller13-Nov-06 12:48 
GeneralRe: Create DataGrid from Excel File Pin
alexfromto14-Nov-06 3:05
alexfromto14-Nov-06 3:05 
GeneralRe: Create DataGrid from Excel File Pin
alexfromto14-Nov-06 3:22
alexfromto14-Nov-06 3:22 
QuestionWill I be limited by Crystal Reports licensing for this issue? Pin
Goalie3513-Nov-06 5:54
Goalie3513-Nov-06 5:54 
QuestionWeb promotion Pin
Nitin198113-Nov-06 5:45
Nitin198113-Nov-06 5:45 
AnswerRe: Web promotion Pin
PavanPareta13-Nov-06 19:48
PavanPareta13-Nov-06 19:48 
QuestionDataGrid & GridView Pin
Rahithi13-Nov-06 4:51
Rahithi13-Nov-06 4:51 
AnswerRe: DataGrid & GridView Pin
Sam Heller13-Nov-06 6:12
Sam Heller13-Nov-06 6:12 
QuestionLinking to a website Pin
kgotsob13-Nov-06 4:51
kgotsob13-Nov-06 4:51 
AnswerRe: Linking to a website Pin
indianet13-Nov-06 8:17
indianet13-Nov-06 8:17 
QuestionHow to use Validation control Pin
Sam.M13-Nov-06 4:45
Sam.M13-Nov-06 4:45 
AnswerRe: How to use Validation control Pin
Parwej Ahamad13-Nov-06 5:54
professionalParwej Ahamad13-Nov-06 5:54 
QuestionUnable to take websetup Pin
Sivaprasad C13-Nov-06 3:41
Sivaprasad C13-Nov-06 3:41 
QuestionFree Web Service??? Pin
QuickerThanYourAverageTurtle13-Nov-06 3:32
QuickerThanYourAverageTurtle13-Nov-06 3:32 
Questionproxy Pin
biaali13-Nov-06 3:15
biaali13-Nov-06 3:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.