What is the difference between Server.Transfer and
Response.Redirect? Why would you choose one over the other?

Answer Posted / xy

Set exCon = Server.CreateObject( "ADODB.Connection" )
Set dbCon = Server.CreateObject
( "ADODB.Connection" )

'open connection to excel
'had to use the JET driver since some of
the ODBC functionality didnt work
exCon.ConnectionTimeout = 30
' exCon.open "Driver={Microsoft Excel Driver
(*.xls)};Dbq=" & Filepath & ";UID=admin;TypeGuessRows=0;"

exCon.open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & Filepath & ";Extended Properties=""Excel
8.0;IMEX=1;ImportMixedTypes=Text;TypeGuessRows=0"""

exCon.CommandTimeout = 90

'open connection to DB
openDBConnection(dbCon)

set rs=exCon.OpenSchema(20)
strPageName = rs(2)
'ADO replaces a ' with a '' by default. we
need to undo this change during the import.
if instr(strPageName, "''") > 0 then
response.write "The name of the
Spreadsheet tab cannot have a comma. "
response.write "The current name
["& replace(strPageName,"''","'") &"] must be corrected
before it can be uploaded.<BR>"
response.End()
end if

response.write "Page <B>" & strPagename
& "</B> was imported"

rs.close
set rs=nothing
Set RS = Server.CreateObject
("ADODB.Recordset")
RS.ActiveConnection = exCon
RS.CursorType =
1
RS.LockType =
1
RS.Source = "SELECT * FROM [" &
strPageName & "] where siteno is not null and projcode = '"
& strProjCode & "'"
RS.Open
if not rs.eof then
arrData = rs.getrows()
else

response.redirect "/error.asp?msg=Template Projcode
Mismatch ! (" & Request.ServerVariables("URL") & ")"
response.end
end if

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are validators and list some validators of asp.net?

531


Suppose you want an asp.net function (client side) executed on the mouseover event of a button. Where do you add an event handler?

554


What are sql joins?

562


What is the file through which you can customize your asp.net application?

537


What permissions do asp.net applications posses by default?

634






What's the ASP.Net Application life cycle?

557


Will the asp.net validators run in server side or client side? How do you do client-side validation in .net? How to disable validator control by client side javascript?

512


Describe session handling in a webfarm?

550


About CLR, reflection and assemblies?

1533


What is the difference between GridView and Repeater controls in ASP.NET?

570


What is the difference between union and join?

556


Explain the use of fragment caching.

655


What is viewstate? What does the "enableviewstate” property do? Whay would I want it on or off?

510


How does cookies work in asp net?

503


List the events in page life cycle.

544