Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 526121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:44:35+00:00 2026-05-13T08:44:35+00:00

I need to modify someone else’s VB code, and I don’t have much experience

  • 0

I need to modify someone else’s VB code, and I don’t have much experience with VB6.
I need to call a SQL2000 stored procedure using ADODB. One of the parameters is of type Binary and it’s giving me problems. Every time I create the parameter, I get an error “Application uses a value of the wrong type for the current operation”. The error happens at the cmd.parameter.append line, it doesn’t even give me a chance call the cmd.execute.

Dim HexPassword As String
Dim BinPassword As String
Dim AsciiCode As Integer
Dim unitDigit As String
Dim TensDigit As String

Set obj_hash = New EDCrypt

' Returns Hash of password hex encoded
HexPassword = obj_hash.GetTextHash(Trim(txtPassword.text), haSHA1)

' Converts Hex Encoded string to Binary encoded string
Dim i As Integer


For i = 1 To 40 Step 2
    unitDigit = Mid(HexPassword, i + 1, 1)
    TensDigit = Mid(HexPassword, i, 1)
    AsciiCode = HexStrtoInt(TensDigit + unitDigit)
    BinPassword = BinPassword + Chr(AsciiCode)
Next i

conn.Open ConnectionString
Dim cmd As ADODB.Command
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = conn
cmd.CommandType = adCmdStoredProc

cmd.CommandText = "ValidatePasswordNew"
cmd.Parameters.Append cmd.CreateParameter("LoginID", adVarChar, adParamInput, 30, UserID)
cmd.Parameters.Append cmd.CreateParameter("ShaPassword", adBinary, adParamInput, 20, BinPassword)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:44:35+00:00Added an answer on May 13, 2026 at 8:44 am

    Try this for your string concatenation:

    BinPassword = BinPassword & ChrB(AsciiCode)
    

    + is not the right string concatenation operator, and using ChrB should convince VB and ADO that you’re really passing it binary data, not character data.

    There’s also a chance DOK is right about the size. You can try setting the size to something you’re certain is longer than you need, or you can probably get around setting the size at all by splitting the operation into two statements:

    cmd.Parameters.Append cmd.CreateParameter("ShaPassword", adBinary, adParamInput)
    cmd.Parameters("ShaPassword").Value = BinPassword
    

    It’s weird, but it’s worked for me in the past.

    Just for added emphasis in case someone sees this again: the size property on Parameter objects does not have to match the exact byte length of your argument; it merely has to be at least big enough to hold your argument.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 499k
  • Answers 499k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer head, *tail = a means to assign the first element… May 16, 2026 at 12:30 pm
  • Editorial Team
    Editorial Team added an answer This is not possible. The other answers have given you… May 16, 2026 at 12:30 pm
  • Editorial Team
    Editorial Team added an answer It's been done: https://issues.apache.org/jira/browse/MATH-375 May 16, 2026 at 12:30 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have to modify a project written by someone else. Because the code is
I think I just need someone to show me the obvious. I have a
This is the situation: We have some binary files (PDFs, PPTs, ZIPz, etc.) stored
I need to modify dynamically a Javascript inside my UIWebView. I load a file
I need to modify the open-source FCKeditor (not CKeditor) to allow users to select
I am in a situation where we need to modify what is being returned
I have a column in SQL Server 2005 that stores a simple chunk of
My PHP application will need to be able to export to (and import from)
Below is a snippet of PHP that I need to get working, I need
I'm tearing my hair out on this one; I want / need / would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.