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

  • SEARCH
  • Home
  • 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 6071503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:03:17+00:00 2026-05-23T10:03:17+00:00

I’m currently working on a small application that needs to connect to a database.

  • 0

I’m currently working on a small application that needs to connect to a database. I do this using the following code…

Set database_connection = New ADODB.Connection
database_connection.ConnectionString = _
 "Driver={MySQL ODBC 3.51 Driver}; Server=HOST; " & _
                              "Database=SCHEMA; " & _
                              "User=USER; " & _
                              "Password=PASSWORD; " & _
                              "Option=3;"
database_connection.Open

This works fine when I run the project from the IDE, and it works file when I run the compiled exe from the command line. If I attempt to run the exe by invoking the CreateProcess function, though, it doesn’t work at all, producing the following error message…

(1) Error#: -2147467259
Desc. : Unspecified error
Source: Provider
Native Error: -2147467259
SQL State: 
Help Context: 1240640
Help File:

Does anyone know what I ought to do about this? I’m working on Windows XP, and the CreateProcess call looks like…

Dim create_result As Long
Dim startup_information As STARTUPINFO
Dim our_process_information As PROCESS_INFORMATION
Dim process_attributes As SECURITY_ATTRIBUTES
Dim thread_attributes As SECURITY_ATTRIBUTES

create_result = CreateProcess(vbNullString, _
                              command_line, _
                              process_attributes, _
                              thread_attributes, _
                              0, _
                              0, _
                              0, _
                              vbNullString, _
                              startup_information, _
                              our_process_information)

(I suspect a permissions problem but don’t know what to do about it if it is. Nothing is appearing in the server log.)

  • 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-23T10:03:17+00:00Added an answer on May 23, 2026 at 10:03 am

    Hmm, that coding style looks awfully familiar…

    One mistake people commonly make is using the “stock” Declare signatures from sources such as API Viewer without understanding what they mean, e.g.:

    Private Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" ( _
        ByVal lpApplicationName As String, _
        ByVal lpCommandLine As String, _
        lpProcessAttributes As SECURITY_ATTRIBUTES, _
        lpThreadAttributes As SECURITY_ATTRIBUTES, _
        ByVal bInheritHandles As Long, _
        ByVal dwCreationFlags As Long, _
        lpEnvironment As Any, _
        ByVal lpCurrentDriectory As String, _
        lpStartupInfo As STARTUPINFO, _
        lpProcessInformation As PROCESS_INFORMATION) As Long
    

    Those As String and As Any declarations have impacts that people often ignore.

    Generally one is far, far better off using the “W” entrypoints and declaring all pointers as ByVal xxx As Long, then applying the VB6 pointer functions where required. But you can lead a horse to water…

    Try this:

    create_result = CreateProcess(vbNullString, _
                                  command_line, _
                                  process_attributes, _
                                  thread_attributes, _
                                  0, _
                                  0, _
                                  ByVal 0&, _
                                  vbNullString, _
                                  startup_information, _
                                  our_process_information)
    

    Or far, far better, try:

    Private Declare Function CreateProcessW Lib "kernel32" ( _
        ByVal lpApplicationName As Long, _
        ByVal lpCommandLine As Long, _
        ByVal lpProcessAttributes As Long, _
        ByVal lpThreadAttributes As Long, _
        ByVal bInheritHandles As Long, _
        ByVal dwCreationFlags As Long, _
        ByVal lpEnvironment As Long, _
        ByVal lpCurrentDriectory As Long, _
        ByVal lpStartupInfo As Long, _
        ByVal lpProcessInformation As Long) As Long
    
    Dim create_result As Long
    Dim startup_information As STARTUPINFO
    Dim our_process_information As PROCESS_INFORMATION
    
    create_result = CreateProcessW(0, _
                                   StrPtr(command_line), _
                                   0, _
                                   0, _
                                   0, _
                                   0, _
                                   0, _
                                   0, _
                                   VarPtr(startup_information), _
                                   VarPtr(our_process_information))
    

    My guess is that this is exactly where you were “breaking” your ODBC driver (sadly an OLEDB Provider would be much better, but I don’t know of a decent free one for MySQL).

    Oh, the problem (and difference here)?

    You were zapping the environment block to nothing, i.e. probably breaking PATH keeps your ODBC driver from working.

    Null pointers, zeros, and empty structures are entirely different things.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
We're building an app, our first using Rails 3, and we're having to build

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.