Try this ..
Dim sbConn As StringBuilder = New StringBuilder
sbConn.Append("Provider=Microsoft.Jet.OLEDB.4.0;Da ta Source=" &
filePath)
sbConn.Append(";Extended Properties=")
sbConn.Append(Convert.ToChar(34))
sbConn.Append("Excel 8.0;HDR=Yes;IMEX=2")
sbConn.Append(Convert.ToChar(34))
Dim cnExcel As OleDbConnection = New
OleDbConnection(sbConn.ToString())
cnExcel.Open()
Dim cmdExcel As OleDbCommand = New OleDbCommand("select * from
[sheet1$]", cnExcel)
Dim drExcel As OleDbDataReader
Try
drExcel =
cmdExcel.ExecuteReader(CommandBehavior.CloseConnec tion)
cmdExcel.Dispose()
If cnExcel.State = ConnectionState.Open Then
cnExcel.Close()
End If
cnExcel.Dispose()
"Wael Soliman" wrote:
hi all
when i try to read from .xls file in .NET windows application
it work correctly but when i try to use the same connection string in
the asp.net i fail while the connection is the same
i need the right connection string and the rigth way to read .xls file
from asp.net
using ADO.NET in both
best regards
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!