vbscript ADO访问oracle 数据库的问题
dimDBConnSetDBConn=CreateObject("ADODB.Connection")DBConn.open"Provider=MSDAORA.Oracl...
dim DBConn
Set DBConn = CreateObject("ADODB.Connection")
DBConn.open "Provider=MSDAORA.Oracle;Data Source=ora9;user id=system;password=oracle"
dim Rst
Set Rst=DbConn.executesql("select count(TELNO1) from TB_PROJECT_CRC where TELNO1='12345678'")
if rst.fields(0)>0 then
msgbox "找到数据"
else
msgbox "没有数据"
end if
以上代码用VBS测试出现参数不正确,或不在范围之内,或与其他参数想冲突!
大虾!为什么? 展开
Set DBConn = CreateObject("ADODB.Connection")
DBConn.open "Provider=MSDAORA.Oracle;Data Source=ora9;user id=system;password=oracle"
dim Rst
Set Rst=DbConn.executesql("select count(TELNO1) from TB_PROJECT_CRC where TELNO1='12345678'")
if rst.fields(0)>0 then
msgbox "找到数据"
else
msgbox "没有数据"
end if
以上代码用VBS测试出现参数不正确,或不在范围之内,或与其他参数想冲突!
大虾!为什么? 展开
1个回答
展开全部
Set conn=Server.CreateObject("ADODB.CONNECTION")
HJSTRCONN="Provider=MSDAORA;Data Source=ora9;User ID=system;Password=oracle"
conn.Open DbConn
Set Rst=DbConn.executesql("select count(TELNO1) as tj from TB_PROJECT_CRC where TELNO1='12345678'")
Response.Write(Rst("tj"))
如果你是否有数据就要修改为这样
Set conn=Server.CreateObject("ADODB.CONNECTION")
HJSTRCONN="Provider=MSDAORA;Data Source=ora9;User ID=system;Password=oracle"
conn.Open DbConn
Set Rst=DbConn.executesql("select * from TB_PROJECT_CRC where TELNO1='12345678'")
If Not Rst.Eof Then
Response.Write("有数据")
Else
Response.Write("无数据")
End If
HJSTRCONN="Provider=MSDAORA;Data Source=ora9;User ID=system;Password=oracle"
conn.Open DbConn
Set Rst=DbConn.executesql("select count(TELNO1) as tj from TB_PROJECT_CRC where TELNO1='12345678'")
Response.Write(Rst("tj"))
如果你是否有数据就要修改为这样
Set conn=Server.CreateObject("ADODB.CONNECTION")
HJSTRCONN="Provider=MSDAORA;Data Source=ora9;User ID=system;Password=oracle"
conn.Open DbConn
Set Rst=DbConn.executesql("select * from TB_PROJECT_CRC where TELNO1='12345678'")
If Not Rst.Eof Then
Response.Write("有数据")
Else
Response.Write("无数据")
End If
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询