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,358 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:
mayankeagle 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:mayankeagle
ID: 10751672
Please proceed with that recommendation.
0
 
LVL 2

Expert Comment

by:diarmaid
ID: 10755993
ok by me
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
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.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now