请高手帮忙看看Config.asp的设置!谢谢! 10
以下是Config1.asp的代码<%'datadb="#data/#data.Asa"Setconn=Server.CreateObject("ADODB.Connec...
以下是Config1.asp的代码
<%
'data
db="#data/#data.Asa"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.open connstr
If Err Then
err.Clear
Set conn = Nothing
Response.Write "数据库连接出错,请检查连接字串。"
Response.End
End If
'定义新闻阅读界面的读取
Dim news1_keywords,news1_title,news1_content,news1_date
Sub ReadNews()
set rs1=server.createobject("adodb.recordset")
sql1="select news1_id,news1_title,news1_content,news1_keywords,news1_date from news1 where news1_id="& ID
rs1.open sql1,conn,3,3
news1_keywords=rs1("news1_keywords")
news1_title=rs1("news1_title")
news1_content=rs1("news1_content")
news1_date=rs1("news1_date")
rs1.close
set rs1=Nothing
End Sub
%>
以下是Config1.asp的代码
<%
'data
db="#data/#data.Asa"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.open connstr
If Err Then
err.Clear
Set conn = Nothing
Response.Write "数据库连接出错,请检查连接字串。"
Response.End
End If
'定义新闻阅读界面的读取
Dim news2_keywords,news2_title,news2_content,news2_date
Sub ReadNews()
set rs1=server.createobject("adodb.recordset")
sql1="select news2_id,news2_title,news2_content,news2_keywords,news2_date from news2 where news2_id="& ID
rs1.open sql1,conn,3,3
news2_keywords=rs1("news2_keywords")
news2_title=rs1("news2_title")
news2_content=rs1("news2_content")
news2_date=rs1("news2_date")
rs1.close
set rs1=Nothing
End Sub
%>
这样的话,我的首页需要分别调用Config1.asp和Config2.asp,能不能把两个文件合成一个?我试了好多遍,都出错了!谢谢大侠们,我很菜!
对不起!错了,第二个“以下是Config1.asp的代码”是Config2.asp的,写错了! 展开
<%
'data
db="#data/#data.Asa"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.open connstr
If Err Then
err.Clear
Set conn = Nothing
Response.Write "数据库连接出错,请检查连接字串。"
Response.End
End If
'定义新闻阅读界面的读取
Dim news1_keywords,news1_title,news1_content,news1_date
Sub ReadNews()
set rs1=server.createobject("adodb.recordset")
sql1="select news1_id,news1_title,news1_content,news1_keywords,news1_date from news1 where news1_id="& ID
rs1.open sql1,conn,3,3
news1_keywords=rs1("news1_keywords")
news1_title=rs1("news1_title")
news1_content=rs1("news1_content")
news1_date=rs1("news1_date")
rs1.close
set rs1=Nothing
End Sub
%>
以下是Config1.asp的代码
<%
'data
db="#data/#data.Asa"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.open connstr
If Err Then
err.Clear
Set conn = Nothing
Response.Write "数据库连接出错,请检查连接字串。"
Response.End
End If
'定义新闻阅读界面的读取
Dim news2_keywords,news2_title,news2_content,news2_date
Sub ReadNews()
set rs1=server.createobject("adodb.recordset")
sql1="select news2_id,news2_title,news2_content,news2_keywords,news2_date from news2 where news2_id="& ID
rs1.open sql1,conn,3,3
news2_keywords=rs1("news2_keywords")
news2_title=rs1("news2_title")
news2_content=rs1("news2_content")
news2_date=rs1("news2_date")
rs1.close
set rs1=Nothing
End Sub
%>
这样的话,我的首页需要分别调用Config1.asp和Config2.asp,能不能把两个文件合成一个?我试了好多遍,都出错了!谢谢大侠们,我很菜!
对不起!错了,第二个“以下是Config1.asp的代码”是Config2.asp的,写错了! 展开
3个回答
Storm代理
2023-07-25 广告
2023-07-25 广告
StormProxies是一家提供动态代理服务器服务的企业,旨在帮助用户更好地管理网络访问和安全。以下是一些关于StormProxies的IP动态代理服务的特点:1. 高匿名性:StormProxies的动态代理服务器具有高匿名性,可以有效...
点击进入详情页
本回答由Storm代理提供
展开全部
可以放在一起,合并后的文件名可以是congfig.asp,代码可以参照以下代码:
Config.asp的代码
<%
db="#data/#data.Asa"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.open connstr
If Err Then
err.Clear
Set conn = Nothing
Response.Write "数据库连接出错,请检查连接字串。"
Response.End
End If
'定义新闻阅读界面的读取
Dim news1_keywords,news1_title,news1_content,news1_date
Sub ReadNews1()
set rs1=server.createobject("adodb.recordset")
sql1="select news1_id,news1_title,news1_content,news1_keywords,news1_date from news1 where news1_id="& ID
rs1.open sql1,conn,3,3
news1_keywords=rs1("news1_keywords")
news1_title=rs1("news1_title")
news1_content=rs1("news1_content")
news1_date=rs1("news1_date")
rs1.close
set rs1=Nothing
End Sub
'定义新闻阅读界面的读取
Dim news2_keywords,news2_title,news2_content,news2_date
Sub ReadNews2() '注意这里和上面的sub子过程不能名称一样
set rs1=server.createobject("adodb.recordset")
sql1="select news2_id,news2_title,news2_content,news2_keywords,news2_date from news2 where news2_id="& ID
rs1.open sql1,conn,3,3
news2_keywords=rs1("news2_keywords")
news2_title=rs1("news2_title")
news2_content=rs1("news2_content")
news2_date=rs1("news2_date")
rs1.close
set rs1=Nothing
End Sub
%>
你的数据库中有两张News表,分别是news1和news2,所以才会有这样的区别,建议把两个表合在一起,这样就不用在调用时这么麻烦。注意,上面的代码修改完成后还要对包含代码做相应的修改,把所有包含Config1.asp和Config2.asp的代码(一般是<!--#include file="……"-->)都改为Config.asp,如果是Config1.asp,则在调用新闻的ReadNews() 部分修改为ReadNews1(),同理如果是Config2.asp,则在调用新闻的ReadNews() 部分修改为ReadNews2(),如有其他的再问我吧!
Config.asp的代码
<%
db="#data/#data.Asa"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.open connstr
If Err Then
err.Clear
Set conn = Nothing
Response.Write "数据库连接出错,请检查连接字串。"
Response.End
End If
'定义新闻阅读界面的读取
Dim news1_keywords,news1_title,news1_content,news1_date
Sub ReadNews1()
set rs1=server.createobject("adodb.recordset")
sql1="select news1_id,news1_title,news1_content,news1_keywords,news1_date from news1 where news1_id="& ID
rs1.open sql1,conn,3,3
news1_keywords=rs1("news1_keywords")
news1_title=rs1("news1_title")
news1_content=rs1("news1_content")
news1_date=rs1("news1_date")
rs1.close
set rs1=Nothing
End Sub
'定义新闻阅读界面的读取
Dim news2_keywords,news2_title,news2_content,news2_date
Sub ReadNews2() '注意这里和上面的sub子过程不能名称一样
set rs1=server.createobject("adodb.recordset")
sql1="select news2_id,news2_title,news2_content,news2_keywords,news2_date from news2 where news2_id="& ID
rs1.open sql1,conn,3,3
news2_keywords=rs1("news2_keywords")
news2_title=rs1("news2_title")
news2_content=rs1("news2_content")
news2_date=rs1("news2_date")
rs1.close
set rs1=Nothing
End Sub
%>
你的数据库中有两张News表,分别是news1和news2,所以才会有这样的区别,建议把两个表合在一起,这样就不用在调用时这么麻烦。注意,上面的代码修改完成后还要对包含代码做相应的修改,把所有包含Config1.asp和Config2.asp的代码(一般是<!--#include file="……"-->)都改为Config.asp,如果是Config1.asp,则在调用新闻的ReadNews() 部分修改为ReadNews1(),同理如果是Config2.asp,则在调用新闻的ReadNews() 部分修改为ReadNews2(),如有其他的再问我吧!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<%
'data
db="#data/#data.Asa"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.open connstr
If Err Then
err.Clear
Set conn = Nothing
Response.Write "数据库连接出错,请检查连接字串。"
Response.End
End If
'定义新闻阅读界面的读取
Dim news1_keywords,news1_title,news1_content,news1_date
Sub ReadNews()
set rs1=server.createobject("adodb.recordset")
sql1="select news1_id,news1_title,news1_content,news1_keywords,news1_date from news1 where news1_id="& ID
rs1.open sql1,conn,3,3
news1_keywords=rs1("news1_keywords")
news1_title=rs1("news1_title")
news1_content=rs1("news1_content")
news1_date=rs1("news1_date")
rs1.close
set rs1=Nothing
End Sub
'定义新闻阅读界面的读取
Dim news2_keywords,news2_title,news2_content,news2_date
Sub ReadNews2()'这里改了,原来是ReadNews
set rs2=server.createobject("adodb.recordset")
sql1="select news2_id,news2_title,news2_content,news2_keywords,news2_date from news2 where news2_id="& ID
rs2.open sql1,conn,3,3
news2_keywords=rs2("news2_keywords")
news2_title=rs2("news2_title")
news2_content=rs2("news2_content")
news2_date=rs2("news2_date")
rs2.close
set rs2=Nothing
End Sub
'把后面的过程名改成ReadNews2,调用时注意下
%>
'data
db="#data/#data.Asa"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.open connstr
If Err Then
err.Clear
Set conn = Nothing
Response.Write "数据库连接出错,请检查连接字串。"
Response.End
End If
'定义新闻阅读界面的读取
Dim news1_keywords,news1_title,news1_content,news1_date
Sub ReadNews()
set rs1=server.createobject("adodb.recordset")
sql1="select news1_id,news1_title,news1_content,news1_keywords,news1_date from news1 where news1_id="& ID
rs1.open sql1,conn,3,3
news1_keywords=rs1("news1_keywords")
news1_title=rs1("news1_title")
news1_content=rs1("news1_content")
news1_date=rs1("news1_date")
rs1.close
set rs1=Nothing
End Sub
'定义新闻阅读界面的读取
Dim news2_keywords,news2_title,news2_content,news2_date
Sub ReadNews2()'这里改了,原来是ReadNews
set rs2=server.createobject("adodb.recordset")
sql1="select news2_id,news2_title,news2_content,news2_keywords,news2_date from news2 where news2_id="& ID
rs2.open sql1,conn,3,3
news2_keywords=rs2("news2_keywords")
news2_title=rs2("news2_title")
news2_content=rs2("news2_content")
news2_date=rs2("news2_date")
rs2.close
set rs2=Nothing
End Sub
'把后面的过程名改成ReadNews2,调用时注意下
%>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询