Click here to Skip to main content
15,902,817 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Hi Graus Reply for ur Message Pin
Christian Graus7-May-08 21:57
protectorChristian Graus7-May-08 21:57 
GeneralRe: Hi Graus Reply for ur Message Pin
Sathish Chakrapani7-May-08 22:11
Sathish Chakrapani7-May-08 22:11 
GeneralRe: Hi Graus Reply for ur Message Pin
Christian Graus7-May-08 22:17
protectorChristian Graus7-May-08 22:17 
GeneralRe: Hi Graus Reply for ur Message Pin
eyeseetee7-May-08 23:21
eyeseetee7-May-08 23:21 
GeneralRe: Hi Graus Reply for ur Message Pin
leckey8-May-08 3:25
leckey8-May-08 3:25 
GeneralRe: Hi Graus Reply for ur Message Pin
Christian Graus8-May-08 10:28
protectorChristian Graus8-May-08 10:28 
JokeRe: Hi Graus Reply for ur Message Pin
Jeremy Falcon8-May-08 4:43
professionalJeremy Falcon8-May-08 4:43 
QuestionProblem in importing data from excel to datagrid in web application... Pin
Balagurunathan S7-May-08 20:53
Balagurunathan S7-May-08 20:53 
Hi Friends...

I am importing data from excel file to a datagrid.I use the following code to do that.But i get "Unspecified error" when i open the oledb connection.Wat could be the problem.Someone help in this regard...The code is given below...


Private Sub btnClick_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClick.Click
Try
Dim filepath As String = System.IO.Path.GetFullPath(Me.FindFile.PostedFile.FileName)
GrdExcel.DataSource = GetExcelData(filepath)
GrdExcel.DataBind()

Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub

Private Function GetExcelData(ByVal strpath As String) As DataSet
Try
Dim ExcelConnection As String = ""
ExcelConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & strpath & ";" & "Extended Properties=""Excel 8.0;HDR=Yes"""
Dim strExcelConn As String = ExcelConnection
Dim dbConn As New Data.OleDb.OleDbConnection(strExcelConn)
Dim strSQL As String
Dim delimeter As Char() = {"\"}
Dim splitter As String() = strpath.Split(delimeter)
Dim file As String = splitter(splitter.Length - 1)
strSQL = "SELECT * FROM [" & file & "$]"
dbConn.Open()
Dim cmd As New Data.OleDb.OleDbCommand(strSQL, dbConn)
Dim dsExcel As New DataSet
Dim daExcel As New Data.OleDb.OleDbDataAdapter(cmd)
daExcel.Fill(dsExcel)
dbConn.Close()
Return dsExcel
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Function

Balaguru

AnswerRe: Problem in importing data from excel to datagrid in web application... Pin
Christian Graus7-May-08 20:55
protectorChristian Graus7-May-08 20:55 
GeneralRe: Problem in importing data from excel to datagrid in web application... Pin
Balagurunathan S7-May-08 21:02
Balagurunathan S7-May-08 21:02 
GeneralRe: Problem in importing data from excel to datagrid in web application... Pin
Christian Graus7-May-08 21:41
protectorChristian Graus7-May-08 21:41 
QuestionBar Code Printing Pin
Anubhava Dimri7-May-08 20:27
Anubhava Dimri7-May-08 20:27 
AnswerRe: Bar Code Printing Pin
Christian Graus7-May-08 20:53
protectorChristian Graus7-May-08 20:53 
Question[Message Deleted] Pin
ashok@techxygen7-May-08 20:15
ashok@techxygen7-May-08 20:15 
AnswerRe: Send Types of credit cards ? Pin
Christian Graus7-May-08 20:53
protectorChristian Graus7-May-08 20:53 
Questionmail problem Pin
Member 45465077-May-08 19:52
Member 45465077-May-08 19:52 
AnswerRe: mail problem Pin
Christian Graus7-May-08 19:56
protectorChristian Graus7-May-08 19:56 
AnswerRe: mail problem Pin
eyeseetee7-May-08 21:37
eyeseetee7-May-08 21:37 
QuestionsetAttribute property in javascript Pin
SamRST7-May-08 19:31
SamRST7-May-08 19:31 
AnswerRe: setAttribute property in javascript Pin
Spunky Coder7-May-08 19:40
Spunky Coder7-May-08 19:40 
GeneralRe: setAttribute property in javascript Pin
SamRST7-May-08 19:49
SamRST7-May-08 19:49 
AnswerRe: setAttribute property in javascript [modified] Pin
Sun Rays7-May-08 19:42
Sun Rays7-May-08 19:42 
GeneralRe: setAttribute property in javascript Pin
SamRST7-May-08 19:47
SamRST7-May-08 19:47 
AnswerRe: setAttribute property in javascript Pin
Christian Graus7-May-08 19:55
protectorChristian Graus7-May-08 19:55 
GeneralRe: setAttribute property in javascript Pin
SamRST7-May-08 20:06
SamRST7-May-08 20:06 

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.