Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 ERROR MESSAGE!!! PLEASE HELP

Author  Topic 

vc56522
Starting Member

11 Posts

Posted - 2005-05-17 : 14:59:36
I am getting this error message:

item cannot be found in the collection corresponding to the requested name or ordinal

my recordset match my table. I have triple check over two days.
We have the same code that works using a different table and it won't work on mine. PLEASE HELP

This is my code:
If Not oRS.EOF Then
Rs_Data.nct_number = Trim(oRS.Fields("nct_number"))

If Not IsNull(oRS.Fields("prev_nct_number")) Then
Rs_Data.prev_nct_number = Trim(oRS.Fields("prev_nct_number"))
End If

If Not IsNull(oRS.Fields("external_tcn")) Then
Rs_Data.external_tcn = Trim(oRS.Fields("external_tcn"))
End If
If Not IsNull(oRS.Fields("shop_order")) Then
Rs_Data.shop_order = Trim(oRS.Fields("shop_order"))
End If
If Not IsNull(oRS.Fields("pms_part")) Then
Rs_Data.pms_part = Trim(oRS.Fields("pms_part"))
End If
If Not IsNull(oRS.Fields("oem_part")) Then
Rs_Data.oem_part = Trim(oRS.Fields("oem_part"))
End If
If Not IsNull(oRS.Fields("cell_code")) Then
Rs_Data.cell_code = Trim(oRS.Fields("cell_code"))
End If
If Not IsNull(oRS.Fields("serial_num")) Then
Rs_Data.serial_num = Trim(oRS.Fields("serial_num"))
End If

If IsDate(oRS.Fields("date_created")) Then
Rs_Data.date_created = FormatDateTime(oRS.Fields("date_created"), vbShortDate)
End If
If Not IsNull(oRS.Fields("originated_by")) Then
Rs_Data.originated_by = Trim(oRS.Fields("originated_by"))
End If
If IsNumeric(oRS.Fields("labor_cost")) Then
Rs_Data.labor_cost = FormatCurrency(oRS.Fields("labor_cost"), -1, vbUseDefault, vbFalse)
End If
If IsNumeric(oRS.Fields("actual_hrs")) Then
Rs_Data.actual_hrs = oRS.Fields("actual_hrs")
End If
If Not IsNull(oRS.Fields("cause_desc")) Then
Rs_Data.cause_desc = Trim(oRS.Fields("cause_desc"))
End If
If Not IsNull(oRS.Fields("sub_cause_desc")) Then
Rs_Data.sub_cause_desc = Trim(oRS.Fields("sub_cause_desc"))
End If
If Not IsNull(oRS.Fields("process_desc")) Then
Rs_Data.process_desc = Trim(oRS.Fields("process_desc"))
End If

If Not IsNull(oRS.Fields("sub_process_desc")) Then
Rs_Data.sub_process_desc = Trim(oRS.Fields("sub_process_desc"))
End If



Else 'EOF Error
Rs_Data.nct_number = "EOF"
End If

'Close the record set.
oRS.Close

'Close the connection to the database.
oConn.Close

End Sub


This is my storeProcedure:



CREATE PROCEDURE p_Sel_AllDetail_Report



@nct_number varchar(10)






AS



SET NOCOUNT ON


select distinct

n.nct_number as NCT ,
n.prev_nct_number ,
n.external_tcn ,
n.shop_order ,
n.pms_part as PMS ,
n.oem_part as OEM ,
m.cell_code ,
s.serial_num ,
n.date_created ,
n.originated_by ,
s.labor_cost ,
s.actual_hrs ,
n.cause_desc as Cause ,
n.sub_cause_desc as SubCause ,
n.process_desc as Process,
n.sub_process_desc as SubProcess








from hpInfo..nct_file As n
Left Join cell_master As m on m.cell_code = n.cell_code
Left Join hpInfo..nct_note As d on d.nct_number = n.nct_number
Left Join hpInfo..shop__mstr as s on s.nct_number = n.nct_number

where n.nct_number = @nct_number


This is where I am calling It:

<SCRIPT language="VBScript">
Dim strConn
Dim strCommand
Dim strShippingTemplate

'Create connection and command strings. User id is visible to client
' side, but has only the read only permissions.

"Server=Hornet; uid=dbEmployee; password=1dbEmployee1; database=EMPLOYEE"
strConn = "Provider=sqloledb;Data Source=Hornet;Initial Catalog=NCT;UID=info;"


strCommand = "p_Sel_AllDetail_Report'"& frmSubmit.txtROD.value& "'"


'Create paths for word templates'
strShippingTemplate = "\\hercules\kelly\mis\templates\SF364s1.dot"


'Call GetData method, which loads the database information into the
'ActiveX control on the client side.
CreateROD.GetData cStr(strConn), cStr(strCommand)

This is where the error is coming from:
'Call MakeRod method which will save and open the Word document for viewing


</SCRIPT>
</body>
</HTML>



Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2005-05-17 : 15:52:16
Given that you have aliased the column name to be 'NCT', do you still have a member of your collection named 'nct_number'

Rs_Data.nct_number = Trim(oRS.Fields("nct_number")) ' Wouldn't this fail?

n.nct_number as NCT , -- Note the Alias

You could bring back your data and then walk through the collection, printing out the names of the columns.

HTH

=================================================================
The surest way to corrupt a youth is to instruct him to hold in higher esteem those who think alike than those who think differently. -Friedrich Nietzsche, philosopher (1844-1900)

Go to Top of Page
   

- Advertisement -