Solved

Run Time Error'-2147217839(80040e51)':The provider cannot derive parameter info and SetParameterInfo has not been called.

Posted on 2003-11-08
6
1,382 Views
Last Modified: 2007-12-19
Hi there,
            I am developping a datbase application in VB.I am using stored procedure for accesiing some data from database.The database is in MS Access
& using a DSN.
            Iam using command & recordset object of adodc.I have an Item_Master table from where I want some details through stored procedure.The stored proc name is "Get_Max_Item_Code" & it has 3 parameters named SOBID,CATCODE,SUBCATCODE .When I set value for these parameters in a sub a got the above mentioned error message.This stored proc was called after another stored procedure which has only one parameter & it was executed without any peroblem.The code segment inwhich problem arrived is:

Public Sub Gen_New_Item_Code()
    Dim Rs As New ADODB.Recordset
    Cmd.CommandType = adCmdStoredProc
    Cmd.CommandText = "Get_New_Item_Code"   'STORED PROCEDURE NAME


    Cmd.Parameters("SOBID") = (Txt_Item(0).Text) 'SOB ID (here is the problem)
    Cmd.Parameters("CATCODE") = Cmb_Item(3).Text  'CATEGORY CODE
    Cmd.Parameters("SUBCATCODE") = Cmb_Item(4).Text  'SUB CATEGORY CODE
    Set Rs = Cmd.Execute()
 
I don't know what to do with this problem.If any one has answer to it ,pls send as soon as possible.
0
Comment
Question by:prem_anish
  • 2
  • 2
6 Comments
 
LVL 30

Accepted Solution

by:
Mayank S earned 50 total points
ID: 9712693
Try using the CreateParameter method of the Command object, as:

Parameter adParam = Cmd.CreateParameter ("SOBID", ....) ' other arguments include parameter-type, size, etc - you can refer to any documentation (or the MSDN help) for this
Cmd.Parameters.Append adParam

Hope that helps.

Mayank.
0
 
LVL 2

Assisted Solution

by:diarmaid
diarmaid earned 50 total points
ID: 9721580
Try adding a .refresh on the commamd object before trying to set the parameters. (I take it the cmd object is defined and set before this procedure as its not set here.) This works with VB + SQL but im not 100% sure about Access.

Public Sub Gen_New_Item_Code()
   Dim Rs As New ADODB.Recordset
   Cmd.CommandType = adCmdStoredProc
   Cmd.CommandText = "Get_New_Item_Code"   'STORED PROCEDURE NAME

   Cmd.Refresh 'This should retrieve the parameter info from the store proc.

   Cmd.Parameters("SOBID") = (Txt_Item(0).Text) 'SOB ID (here is the problem)
   Cmd.Parameters("CATCODE") = Cmb_Item(3).Text  'CATEGORY CODE
   Cmd.Parameters("SUBCATCODE") = Cmb_Item(4).Text  'SUB CATEGORY CODE
   Set Rs = Cmd.Execute()
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 10751672
Please proceed with that recommendation.
0
 
LVL 2

Expert Comment

by:diarmaid
ID: 10755993
ok by me
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
substring method in java 1 122
drawing animated level bar based on numbers 3 97
Problem to start Neon 20 106
Interview question Javascript, database 12 63
Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
This article will show, step by step, how to integrate R code into a R Sweave document
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question