Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 22nd, 2004, 04:35 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , .
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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



Reply With Quote
  #2 (permalink)  
Old November 22nd, 2004, 06:14 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

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
Reply With Quote
  #3 (permalink)  
Old November 22nd, 2004, 06:41 PM
Friend of Wrox
 
Join Date: Jan 2004
Location: , , USA.
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Also, try to use "Option Explicit" at the top of your code
Reply With Quote
  #4 (permalink)  
Old November 23rd, 2004, 11:41 AM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , .
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote
  #5 (permalink)  
Old November 23rd, 2004, 03:04 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

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
Reply With Quote
  #6 (permalink)  
Old November 23rd, 2004, 04:02 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , .
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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






Reply With Quote
  #7 (permalink)  
Old November 23rd, 2004, 04:03 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , .
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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




Reply With Quote
  #8 (permalink)  
Old November 23rd, 2004, 07:38 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Why is that you are posting the entire post again here as reply?

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object required jpaul VB Databases Basics 5 November 14th, 2007 12:10 PM
object required alitoday Classic ASP Components 1 December 28th, 2004 01:17 AM
Object required error ?? hman SQL Server ASP 11 June 21st, 2004 10:59 AM
"Object Required" message chacquard Access 2 February 9th, 2004 12:50 PM



All times are GMT -4. The time now is 10:34 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.