PRB: RDO Run-time Error '40060': Incorrect Type for Parameter
ID: Q181857
|
The information in this article applies to:
-
Microsoft Visual Basic Enterprise Edition for Windows, version 5.0
SYMPTOMS
When assigning the value of a field from one Resultset to another (such as,
rs2!FieldX = rs1!FieldY), you may get the following error:
Run-time error '40060'
Incorrect type for parameter
CAUSE
FieldY has a NULL value.
RESOLUTION
To resolve this problem, do one of the following:
STATUS
Microsoft is researching this problem and will post new information here in
the Microsoft Knowledge Base as it becomes available.
MORE INFORMATIONSteps to Reproduce Behavior
- Use ISQL/W or another tool to create a table using the following SQL
statement:
CREATE TABLE dbo.TestNull (
ID int NOT NULL ,
F1 varchar (10) NULL ,
CONSTRAINT PK_TestAddNew_1__15 PRIMARY KEY CLUSTERED
(
ID
)
)
- Add a record, leaving F1 with a NULL value. You may do this in
ISQL/W or VISDATA in Visual Basic.
- In Visual Basic 5.0, create a new project.
- Reference Microsoft Remote Data Objects 2.0.
- Add a command button (Command1) and the following code:
Private Sub Command1_Click()
Dim cn As rdoConnection, rs1 As rdoResultset, rs2 As rdoResultset
rdoEngine.rdoDefaultCursorDriver = rdUseServer
Set cn = rdoEngine(0).OpenConnection("", rdDriverNoPrompt, False, _
"Driver={SQL Server};Server=moonbase;uid=sa;pwd=;database=pubs")
Set rs1 = cn.OpenResultset("SELECT * FROM TestNull", _
rdOpenKeyset, rdConcurValues, rdExecDirect)
rs1.MoveLast
Set rs2 = cn.OpenResultset("SELECT * FROM TestNull", _
rdOpenKeyset, rdConcurValues, rdExecDirect)
rs2.Edit
rs2!F1 = rs1!F1
rs2.Update
rs1.Close
rs2.Close
cn.Close
End Sub
- Run the project and click the command button and the error message
will appear.
- Change the line:
rs2!F1 = rs1!F1
-to-
rs2!F1 = rs1!F1.Value
- Run the project again, and the error will not appear.
(c) Microsoft Corporation 1998, All Rights Reserved.
Contributions by Malcolm Stewart, Microsoft Corporation
Additional query words:
kbVBp500 kbVBp kbWinOS98 kbDSupport kbdse kbNoKeyWord
Keywords : kbGrpVBDB
Version :
Platform :
Issue type : kbprb
|