access| Data | database | download | The implementation of the idea is from: <% use, and then the ASP to execute the error.
Now just write him as an ASP code, easy to use.
Because such words can be directly executed on the OK, do not have to download the database and then build the table and so on .... And then upload the overlay ...
My code is just to achieve this function: be practical. Please give me a lot of advice ....
By the way, add the background of this code: I also proposed that the MDB mapping is better, also made a video, and then he hard to ask: do not do insinuate of the virtual host how to do, so hastily wrote such a piece of code to avoid his download and then manually insert <% and then upload the trouble.
1. Added a detailed description of the error.
2. I should be able to solve this problem with a random table.
3. I add a number of <% can also basically avoid the problem of%> it. I think this is a good idea when there are no binary data involved in the simple other places.
At the same time thank Zhouzhen for his criticism. Welcome to criticize again. Thank you
<%option explicit%>
<%
Dim Str_form,str_version,i
Dim Mdbfile,conn,rec,str_notdown,tabale_notdown
Str_version= "Code by like sad qq:122545971<br>"
str_version=str_version& "page code function: Prevent Access database from being downloaded <br>" & "feature is: easy to use, upload directly to the space execution is complete. <br> "
str_version=str_version& "Powers Alliance family <a href= ' http://www.powers.com.cn ' >_blank>http:// Www.powers.com.cn</a><br> "
Mdbfile=request ("Mdbfile")
If mdbfile= "" Then
str_form= "<form action= ' method= ' post ' > database file name [contains relative path]:<input type=text <input type= ' submit ' name= ' submit ' value= ' prevent download ' > '
Call Out_ys (Str_form)
Response.End
End If
Mdbfile=server.mappath (Mdbfile)
Set Conn=server.createobject ("Adodb.connection")
On Error Resume Next
Conn.Open "Driver={microsoft Access Driver (*.mdb)};uid=admin;pwd=;d bq=" &mdbfile
If ERR Then
Err. Clear
Set Conn = Nothing
Call Out_ys ("Database connection error, check database name and relative path is correct <a href= ' javascript:history.back () ' > Return </A>")
Response.End
End If
On Error Resume Next
' Take a random table name
RANDOMIZE ()
Tabale_notdown= "Notdown" &int (9999*rnd () +1)
Tabale_notdown= "notdown678"
Conn.execute ("CREATE TABLE" &tabale_notdown& "(Notdown image)")
If Err Then
Call Out_ys ("Error:<b>" &err.) Description & "</b>,<br><br> please follow the prompts to solve this problem")
Else
STR_NOTDOWN=CHRB (&CHRB) (37)
For I=1 to 13
STR_NOTDOWN=STR_NOTDOWN&CHRB (&CHRB) (37)
Next
Set Rec=server.createobject ("Adodb.recordset")
Rec. Open "SELECT * from Notdown", conn,1,3
Rec.addnew
Rec ("Notdown"). AppendChunk Str_notdown
Rec.update
Rec.close
Set rec=nothing
Call Out_ys ("Prevent download complete, and remind if you are not ASP extension, please modify to ASP")
End If
Conn.close
Set conn=nothing
Sub Out_ys (str_out)
Response.Write "<div align=left>" &str_version& "</div><center>" & "<br><br ><BR ><br> "&str_out&" <br> "&" <br> "&" <br> "&" <br> "& "<br>" & "&l t;br></center>"
End Sub
%>