 |
| Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

November 22nd, 2004, 04:35 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
object required
I am trying to get fullName. This code complains about
object required. I dont understand why it is complaining?
<%@ Language=VBScript %>
<%
'ASP Header
Option Explicit
Response.Buffer=true
Response.Expires=-1
Dim oConnection
Dim oRecordset
Dim oCommand
Dim oEmployeeName
const sDataBaseConnectionString= "DATABASE=hi_T;DSN="";UID=;
Dim mode
mode=Request.Form("hdnMode")
If mode= "" Then ' default value is blank
mode = "Select"
End if
Select Case mode
Case "Select"
Call FetchAuthors()
Case "Delete"
Call DeleteAuthor()
Call FetchAuthors()
Case "Insert"
Call InsertAuthor()
Call FetchAuthors()
Case "Update"
Call UpdateAuthor()
Call FetchAuthors()
Case "Edit"
Call FetchEditAuthor()
Call FetchAuthors()
End Select
Sub FetchAuthors()
'Database Connection String
On Error Resume Next
Set oConnection=Server.CreateObject("ADODB.Connection" )
oConnection.ConnectionString=sDataBaseConnectionSt ring
oConnection.Open 'Connect to the databse
If Err.number <> 0 Then
Response.Write("Problem establishing Database connection")
'Response.End
End If
Set oCommand = Server.CreateObject("ADODB.Command")
oCommand.ActiveConnection=oConnection
oCommand.CommandType=4
oCommand.CommandText="spp_CustRate"
set objParam1=objCmd.CreateParameter("@iEmpID",3,1,12)
set objParam2=objCmd.CreateParameter("@iSubcontID",3,1 ,12)
set objParam3=objCmd.CreateParameter("@iTaskID",3,1,12 )
set objParam4=objCmd.CreateParameter("@iProjDetID",3,1 ,12)
oCommand.Parameters.Append(objParam1)
oCommand.Parameters.Append(objParam2)
oCommand.Parameters.Append(objParam3)
oCommand.Parameters.Append(objParam4)
if (iEmpID ="")then
objParam1.value=null
else
objParam1.value=iEmpID
end if
if (iSubcontID="")then
objParam2.value=null
else
objParam2.value=iSubcontID
end if
if (iTaskID="")then
objParam3.value =null
else
objParam3.value =iTaskID
end if
if (iProjDetID="")then
objParam4.value =null
else
objParam4.value =iProjDetID
end if
'Response.Write oCommand.CommandText
Set oRecordset= oCommand.Execute
End Sub
Sub InsertAuthor()
on Error Resume Next
Set oConnection=Server.CreateObject("ADODB.Connection" )
oConnection.ConnectionString=sDataBaseConnectionSt ring
oConnection.Open
If Err.number <> 0 Then
Response.Write("Problem establishing Database connection")
'Response.End
End If
set oCommand=Server.CreateObject("ADODB.Command")
oCommand.ActiveConnection=oConnection
oCommand.CommandType=4
oCommand.CommandText= BuildEmployeeName()
Response.Write oCommand.CommandText
oCommand.Execute
End Sub
Dim ResType
Dim iSubcontID
Dim iEmpID
Dim iProjDetID
Dim iTaskID
Dim SQL
Dim strName
ResType= "E"
iSubcontID = ""
iTaskID = 383
iEmpID = 743
iProjDetID = 2981
if ResType="E" then
iTaskID=383 and iEmpID =743 and iProjDetID =2981
else
iSubcontID =26 and iTaskID=157 and iProjDetID =2981
end if
Function BuildEmployeeName()
if ResType= "E" then
SQL="Select vsEmpFirstName+ ',' +vsEmpLastName As vsName from tblEmployeeInformation where iEmpId=" &cstr(iEmpID)
else
SQL="Select vsEmpFirstName+ ','+ vsEmpLastName As vsName from tblSubCont where iSubcontId=" &cstr(iSubcontID)
end if
if not oRecordset.EOF then
strName =oRecordset.Fields("vsName")
BuildEmployeeName=strName
end if
End Function
%>
<input type="hidden" name=hdnMode>
<input type='text' name='txtFullName' value='<%=BuildEmployeeName%>'>
Note: this part is complaining about object required oRecordset
|
|

November 22nd, 2004, 06:14 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
I too don't understand which line is complaining that. Can you post the line number that complains? Finding it difficult to go through the entire code. It would be better to post the line number and relevant code here rather than posting all that you have.
_________________________
- Vijay G
Strive for Perfection
|
|

November 22nd, 2004, 06:41 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Also, try to use "Option Explicit" at the top of your code
|
|

November 23rd, 2004, 11:41 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
The<% Do while not oRecordset.EOF %>
<input type="text" name="txtdecHourlyRate" value="<%=oRecordset.Fields("dtRateFrom").value%>" >
<input type="text" name="txtdecHourlyRate1" value="<%=oRecordset.Fields("dtRateFrom").value%>" >
<input type="text" name="txtdecHourlyRate" value="<%=oRecordset.Fields("decHourlyRate").value %>">
<%oRecordset.MoveNext() error it shows here
object required
|
|

November 23rd, 2004, 03:04 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
I don't find the code you posted in the previous post being used in the code that you submitted in your first post. Are these codes placed in the same asp file? Where have you declared the Recordset object and where are you using that and what does the query or procedure return as the result? Does the result come up fine?
Cheers!
_________________________
- Vijay G
Strive for Perfection
|
|

November 23rd, 2004, 04:02 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Posted - 11/22/2004 : 8:35:17 PM
--------------------------------------------------------------------------------
I am trying to get fullName. This code complains about
object required. I dont understand why it is complaining?
<%@ Language=VBScript %>
<%
'ASP Header
Option Explicit
Response.Buffer=true
Response.Expires=-1
Dim oConnection
Dim oRecordset
Dim oCommand
Dim oEmployeeName
const sDataBaseConnectionString= "DATABASE=hi_T;DSN="";UID=;
Dim mode
mode=Request.Form("hdnMode")
If mode= "" Then ' default value is blank
mode = "Select"
End if
Select Case mode
Case "Select"
Call FetchAuthors()
Case "Delete"
Call DeleteAuthor()
Call FetchAuthors()
Case "Insert"
Call InsertAuthor()
Call FetchAuthors()
Case "Update"
Call UpdateAuthor()
Call FetchAuthors()
Case "Edit"
Call FetchEditAuthor()
Call FetchAuthors()
End Select
Sub FetchAuthors()
'Database Connection String
On Error Resume Next
Set oConnection=Server.CreateObject("ADODB.Connection" )
oConnection.ConnectionString=sDataBaseConnectionSt ring
oConnection.Open 'Connect to the databse
If Err.number <> 0 Then
Response.Write("Problem establishing Database connection")
'Response.End
End If
Set oCommand = Server.CreateObject("ADODB.Command")
oCommand.ActiveConnection=oConnection
oCommand.CommandType=4
oCommand.CommandText="spp_CustRate"
set objParam1=objCmd.CreateParameter("@iEmpID",3,1,12)
set objParam2=objCmd.CreateParameter("@iSubcontID",3,1 ,12)
set objParam3=objCmd.CreateParameter("@iTaskID",3,1,12 )
set objParam4=objCmd.CreateParameter("@iProjDetID",3,1 ,12)
oCommand.Parameters.Append(objParam1)
oCommand.Parameters.Append(objParam2)
oCommand.Parameters.Append(objParam3)
oCommand.Parameters.Append(objParam4)
if (iEmpID ="")then
objParam1.value=null
else
objParam1.value=iEmpID
end if
if (iSubcontID="")then
objParam2.value=null
else
objParam2.value=iSubcontID
end if
if (iTaskID="")then
objParam3.value =null
else
objParam3.value =iTaskID
end if
if (iProjDetID="")then
objParam4.value =null
else
objParam4.value =iProjDetID
end if
'Response.Write oCommand.CommandText
Set oRecordset= oCommand.Execute
End Sub
Sub InsertAuthor()
on Error Resume Next
Set oConnection=Server.CreateObject("ADODB.Connection" )
oConnection.ConnectionString=sDataBaseConnectionSt ring
oConnection.Open
If Err.number <> 0 Then
Response.Write("Problem establishing Database connection")
'Response.End
End If
set oCommand=Server.CreateObject("ADODB.Command")
oCommand.ActiveConnection=oConnection
oCommand.CommandType=4
oCommand.CommandText= BuildEmployeeName()
Response.Write oCommand.CommandText
oCommand.Execute
End Sub
Dim ResType
Dim iSubcontID
Dim iEmpID
Dim iProjDetID
Dim iTaskID
Dim SQL
Dim strName
ResType= "E"
iSubcontID = ""
iTaskID = 383
iEmpID = 743
iProjDetID = 2981
if ResType="E" then
iTaskID=383 and iEmpID =743 and iProjDetID =2981
else
iSubcontID =26 and iTaskID=157 and iProjDetID =2981
end if
Function BuildEmployeeName()
if ResType= "E" then
SQL="Select vsEmpFirstName+ ',' +vsEmpLastName As vsName from tblEmployeeInformation where iEmpId=" &cstr(iEmpID)
else
SQL="Select vsEmpFirstName+ ','+ vsEmpLastName As vsName from tblSubCont where iSubcontId=" &cstr(iSubcontID)
end if
if not oRecordset.EOF then
strName =oRecordset.Fields("vsName")
BuildEmployeeName=strName
end if
End Function
%>
<input type="hidden" name=hdnMode>
<input type='text' name='txtFullName' value='<%=BuildEmployeeName%>'>
Note: this part is complaining about object required oRecordset
|
|

November 23rd, 2004, 04:03 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I am trying to get fullName. This code complains about
object required. I dont understand why it is complaining?
<%@ Language=VBScript %>
<%
'ASP Header
Option Explicit
Response.Buffer=true
Response.Expires=-1
Dim oConnection
Dim oRecordset
Dim oCommand
Dim oEmployeeName
const sDataBaseConnectionString= "DATABASE=hi_T;DSN="";UID=;
Dim mode
mode=Request.Form("hdnMode")
If mode= "" Then ' default value is blank
mode = "Select"
End if
Select Case mode
Case "Select"
Call FetchAuthors()
Case "Delete"
Call DeleteAuthor()
Call FetchAuthors()
Case "Insert"
Call InsertAuthor()
Call FetchAuthors()
Case "Update"
Call UpdateAuthor()
Call FetchAuthors()
Case "Edit"
Call FetchEditAuthor()
Call FetchAuthors()
End Select
Sub FetchAuthors()
'Database Connection String
On Error Resume Next
Set oConnection=Server.CreateObject("ADODB.Connection" )
oConnection.ConnectionString=sDataBaseConnectionSt ring
oConnection.Open 'Connect to the databse
If Err.number <> 0 Then
Response.Write("Problem establishing Database connection")
'Response.End
End If
Set oCommand = Server.CreateObject("ADODB.Command")
oCommand.ActiveConnection=oConnection
oCommand.CommandType=4
oCommand.CommandText="spp_CustRate"
set objParam1=objCmd.CreateParameter("@iEmpID",3,1,12)
set objParam2=objCmd.CreateParameter("@iSubcontID",3,1 ,12)
set objParam3=objCmd.CreateParameter("@iTaskID",3,1,12 )
set objParam4=objCmd.CreateParameter("@iProjDetID",3,1 ,12)
oCommand.Parameters.Append(objParam1)
oCommand.Parameters.Append(objParam2)
oCommand.Parameters.Append(objParam3)
oCommand.Parameters.Append(objParam4)
if (iEmpID ="")then
objParam1.value=null
else
objParam1.value=iEmpID
end if
if (iSubcontID="")then
objParam2.value=null
else
objParam2.value=iSubcontID
end if
if (iTaskID="")then
objParam3.value =null
else
objParam3.value =iTaskID
end if
if (iProjDetID="")then
objParam4.value =null
else
objParam4.value =iProjDetID
end if
'Response.Write oCommand.CommandText
Set oRecordset= oCommand.Execute
End Sub
Sub InsertAuthor()
on Error Resume Next
Set oConnection=Server.CreateObject("ADODB.Connection" )
oConnection.ConnectionString=sDataBaseConnectionSt ring
oConnection.Open
If Err.number <> 0 Then
Response.Write("Problem establishing Database connection")
'Response.End
End If
set oCommand=Server.CreateObject("ADODB.Command")
oCommand.ActiveConnection=oConnection
oCommand.CommandType=4
oCommand.CommandText= BuildEmployeeName()
Response.Write oCommand.CommandText
oCommand.Execute
End Sub
Dim ResType
Dim iSubcontID
Dim iEmpID
Dim iProjDetID
Dim iTaskID
Dim SQL
Dim strName
ResType= "E"
iSubcontID = ""
iTaskID = 383
iEmpID = 743
iProjDetID = 2981
if ResType="E" then
iTaskID=383 and iEmpID =743 and iProjDetID =2981
else
iSubcontID =26 and iTaskID=157 and iProjDetID =2981
end if
Function BuildEmployeeName()
if ResType= "E" then
SQL="Select vsEmpFirstName+ ',' +vsEmpLastName As vsName from tblEmployeeInformation where iEmpId=" &cstr(iEmpID)
else
SQL="Select vsEmpFirstName+ ','+ vsEmpLastName As vsName from tblSubCont where iSubcontId=" &cstr(iSubcontID)
end if
if not oRecordset.EOF then
strName =oRecordset.Fields("vsName")
BuildEmployeeName=strName
end if
End Function
%>
<input type="hidden" name=hdnMode>
<input type='text' name='txtFullName' value='<%=BuildEmployeeName%>'>
Note: this part is complaining about object required oRecordset
happygv
Advanced Member
India
1896 Posts
Posted - 11/22/2004 : 10:14:56 PM
--------------------------------------------------------------------------------
I too don't understand which line is complaining that. Can you post the line number that complains? Finding it difficult to go through the entire code. It would be better to post the line number and relevant code here rather than posting all that you have.
_________________________
- Vijay G
Strive for Perfection
--------------------------------------------------------------------------------
Edited by - happygv on 11/22/2004 10:16:41 PM
shahchi1
New Member
79 Posts
Posted - 11/22/2004 : 10:41:48 PM
--------------------------------------------------------------------------------
Also, try to use "Option Explicit" at the top of your code
shoakat
New Member
81 Posts
Posted - 11/23/2004 : 3:41:59 PM
--------------------------------------------------------------------------------
The<% Do while not oRecordset.EOF %>
<input type="text" name="txtdecHourlyRate" value="<%=oRecordset.Fields("dtRateFrom").value%>" >
<input type="text" name="txtdecHourlyRate1" value="<%=oRecordset.Fields("dtRateFrom").value%>" >
<input type="text" name="txtdecHourlyRate" value="<%=oRecordset.Fields("decHourlyRate").value %>">
<%oRecordset.MoveNext() error it shows here
object required
happygv
Advanced Member
India
1896 Posts
Posted - 11/23/2004 : 7:04:16 PM
|
|

November 23rd, 2004, 07:38 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Why is that you are posting the entire post again here as reply?
_________________________
- Vijay G
Strive for Perfection
|
|
 |