Solved

vb6 :problem executing stored procedure, incorrect parameter type for ADODB command object/?

Posted on 2009-05-09
7
403 Views
Last Modified: 2013-12-25
I'm trying to execute a SQL SERVER 2000 stored procedure from vb6.

I have two parameters that are causing a problem

1) Date time parameter
2)) a TEXT parameter

When excuting  I get a run time error. The problem appears to be the parameters themselves.

 The stored procedure and vb6 code examples is shown in code section.
stored procedure  is in SQL SERVER 2000

Basically could someone write the code for a vb6 to execute the following stored procedure (see code snippet).

Many thanks



The stored procedure is 
 
CREATE PROCEDURE InsertData
@guid      UNIQUEIDENTIFER,
@insertDate DATETIME,
@INSETTEXT TEXT
 
 
 
.Parameters.Append CreateParameter("@GUID", _
                                           DataTypeEnum.adguid?, _
                                           adParamInput)
    
 
    .Parameters.Append CreateParameter("@InsertDate", _
                                           DataTypeEnum.adDBDate?, _
                                           adParamInput)
 
        .Parameters.Append CreateParameter("@InsertText", _
                                                                       ??????, _
                                                                        adParamInput)
 
        .Parameters.Append CreateParameter("@Date_Saved", _
                                           DataTypeEnum.adDBDate, _
                                           adParamInput)
 
 
AS

Open in new window

0
Comment
Question by:peter3244
7 Comments
 
LVL 19

Expert Comment

by:Rimvis
ID: 24364110
Try adLongVarChar
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 24404266
So I guess you don't need any more help with this question?
0
 

Author Comment

by:peter3244
ID: 24405523
The sugestion didn't work. I have worked around the ;problem by doing the update in code. I guess nobody can provide me with a working example for text AND date fields. At this point I am very disallusioned with this site. Having paid a 200 pounds for access I didn't expect sarcastic comments like the one above.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 24405655
according to the documentation, is should be adLongVarChar, you might try dLongVarWChar instead.
0
 

Author Closing Comment

by:peter3244
ID: 31579780
thanks for your help, As I said I have worked around the problem and I guess that the problem with the date must be to do with the server setings.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 24406897
>>I guess nobody can provide me with a working example for text AND date fields.<<
You were given a solution which you chose to ignore for 4 days and only commented when I asked.

>>At this point I am very disallusioned with this site.<<
This site is a two-way street.  We volunteer our time with solutions with the condition that you provide feedback.  That is in the guidelines that you agree to every time you sign on.

>>The sugestion didn't work.<<
While we may be quite tech savy we do not read crystal balls.  We cannot see what ultimately will work for you or not.

>>I didn't expect sarcastic comments like the one above.<<
I am sorry you took it that way.  I was more then prepared to help you, but I was not going to do it if you had abandoned the question.

Next time, try and be a tad more proactive with your responses and you will get excellent help.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 24406924
Incidentally, here is a link to the correct mappings:
Data Type Mapping
http://www.carlprothman.net/Technology/DataTypeMapping/tabid/97/Default.aspx

As you can see:
Text is in fact adLongVarChar (ntext is adLongVarWChar) and datetime is adDBTimeStamp

But there are other problems with the way you are setting up the parameters for the Stored Procedure and I would be surprised that you get it to work as is.  For example, your Stored Procedure contains 3 parameters, yet you appear to be setting up 4 parameters in your VB code, and there are other problems as well.
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
WPF - Tooltips for ComboBox items 5 75
Put window Form inside tab page 10 33
Close form "before" open 3 40
Creating a route in asp.net webforms 2 28
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

803 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