Vb.net 使用vb连接到sql server 2008
反应是Vb.net 使用vb连接到sql server 2008,vb.net,sql-server-2008,asp-classic,Vb.net,Sql Server 2008,Asp Classic,反应是 Function DBConnect() Dim vConnString, wfConnection, objConn set objConn = Server.CreateObject("ADODB.Connection") objConn.Open Application("DB_CONNECT") set DBConnect = objConn exit function Response.Write("connected to Server 2008") End Fun
Function DBConnect()
Dim vConnString, wfConnection, objConn
set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open Application("DB_CONNECT")
set DBConnect = objConn
exit function
Response.Write("connected to Server 2008")
End Function
Function GetValue()
Dim objCmd, objRS
Set objCMD = Server.CreateObject("ADODB.Command")
Set objRs = Server.CreateObject("ADODB.Recordset")
With (objCMD)
.ActiveConnection = DBConnect()
.CommandType = adCmdStoredProc
.CommandText = "select * from Acc.dbo.table"
set ObjRS = .Execute()
End With
if err.number = 0 then
if not objRs.EOF then
arrData = objRs.GetRows
vDesc = arrData(5,0)
else
vDesc = vValue
end if
GetDescFromCode = True
end if
在调试过程中,我发现它并没有进入objRs.EOF if循环中……知道出了什么问题吗
响应之前有退出功能
1.连接状态为1,错误号为0。objRs.EOF为真还是假?
。CommandType=adCmdStoredProc
错误,因为您没有在那里使用sp。请尝试.CommandType=adCmdText
connected to Server 2008