Home > front end >  Ask how the ASP news topic and read from the database id and content?
Ask how the ASP news topic and read from the database id and content?

Time:11-28

Web small white one, is learning to do website, ASP + Access, the problems at present:
Newslist. Asp page will be listed in the database id of the top 10 news topic, click the news link page jump to newscontent. Asp page
Now newslist. Asp page can already listed in the database id of the top 10 records, but I don't know how to the id corresponding news contents in the newcontent. Asp page displayed?

CodePudding user response:

In the newcontent. Asp page to build a query, display the news content,

CodePudding user response:

reference 1st floor hua-bing li reply:
& lt; A href="https://bbs.csdn.net/topics/newcontent.asp.asp? ID="& gt; Skip links & lt;/a> In the newcontent. Asp page to build a query, display the news content,

Hello, thank you, may I not clear problem description
Href="https://bbs.csdn.net/topics/newcontent.asp.asp? ID=has achieved, click on the links should be to jump to newcontent. Asp page to display the content of the news, but add the ID parameter page doesn't exist, how to solve the problem?

CodePudding user response:

You have to do a show news content page, showNews. Asp,
Statements like
Set the rs=server. Createobject (" adodb. You ")
SQL="select * from News_Tb where ID=" & amp; Request (" ID ")
SQL=SQL & amp; "The order by ID desc
"Rs. The open SQL, conn, 1, 1)

CodePudding user response:

Upstairs in the SQL statement is no problem, but you must be aware of the new page open database header footer also closed, or it will be an error

CodePudding user response:

Connect the database file (/code) posted,

Generally need to be modified for (see the database connection, open code)
Id=int (id) to filter the
If id="or" isnumeric (id)=false then if receive the id of the data is not digital, it returns
The response. Redirect (" newslist. Asp ")
End the if
Conn. Execute "update NewsTable set NewsHits=NewsHits + 1 where NewsID=" & amp; Id this is click on the number of + 1
Dim the rs, SQL
Set the rs=server. CreateObject (" adodb. You ")
SQL="select * from NewsTable where NewsID=" & amp; Id to open the news content,
Rs. The open SQL, conn, 0, 1
TTL=rs (" NewsTitle ")
Acls=rs (" SsClass ")
Acont=rs (" NewsContent ")
Ahit=rs (" NewsHits ")
Rs. Close close news content

% & gt;
That's basically mean.
It is ok to call below,

CodePudding user response:

In the list page has a link, to receive the news content page id data, news, and then open the id

Newscontent page receive id
<%
Dim id
Id=request. ServerVariables (" id ") to receive passed the id of the data
Id=int (id) to filter the
If id="or" isnumeric (id)=false then if receive the id of the data is not digital, it returns
The response. Redirect (" newslist. Asp ")
End the if
Conn. Execute "update NewsTable set NewsHits=NewsHits + 1 where NewsID=" & amp; Id this is click on the number of + 1
Dim the rs, SQL
Set the rs=server. CreateObject (" adodb. You ")
SQL="select * from NewsTable where NewsID=" & amp; Id to open the news content,
Rs. The open SQL, conn, 0, 1
TTL=rs (" NewsTitle ")
Acls=rs (" SsClass ")
Acont=rs (" NewsContent ")
Ahit=rs (" NewsHits ")
Rs. Close close news content

% & gt;
That's basically mean.
It is ok to call below,

CodePudding user response:

A simple database applications written in asp
http://bbs.ttasp.com/forum.php? Mod=viewthread& Tid=508 & amp; Fromuid=1
(source: everyday ASP home)

CodePudding user response:

Thanks for elder people above reply, thank you

CodePudding user response:

Steps are as follows:
1. Connect ACCESS database using ASP
2. The lookup table record
3. Shows relevant information can

CodePudding user response:

? ID=12 + or + (drop table NewsTable)

This will not be content
  •  Tags:  
  • ASP
  • Related