hi this is my first blog in this blogspot , hope it may help you ..
i have seen most of the time software people require to display records from an Microsoft Excel in an ASP. We could use SQL command while retreving data from an excel sheet. for the we know how to connect with sql
here is the sql connection string :
strConnection = "DBQ=" & Server.MapPath("nameofexcelfile.xls") & "; DRIVER={Microsoft Excel Driver (*.xls)};"
We will use a specific driver to connect to Excel files.
so for that we can use ODBC
An Example :
strConnection = "DBQ=" & Server.MapPath("nameofexcelfile.xls") & "; DRIVER={Microsoft Excel Driver (*.xls)};"
Set conn = Server.CreateObject("ADODB.Connection")
Set rss = Server.CreateObject("ADODB.Recordset")
cn.open strConnection
sql="select * from tablename;"
rss.Open sql, conn, adOpenStatic, adLockPessimistic
do while not rss.eof
response.write rss("Fieldname")
rss.movenext
loop
rss.close
Set rss = nothing
conn.close
Set conn = nothing
and now u can access you excel content in you are asp coding
thank you.
No comments:
Post a Comment