CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2010
    Posts
    2

    [RESOLVED] The multi-part identifier could not be bound.

    Hey all...

    I am writing a webservice to take care of some license problems we have.. it need to be able to see if there are more licenses in use than the client have in total, and thereby allowing a client to either open a program or not. based on how many licenses that are in use already.

    problem is that i get this error when i try to test out by code bit:

    "System.Data.SqlClient.SqlException: The multi-part identifier "AcroRd32.exe" could not be bound."

    what i am doing is that i try to send an sqlCommand to my database to get back the number of maxLicenses allowed..

    the c# code is here:
    string s = "Select maxLicenses from LicenseList where programName = " + program;
    con = new SqlConnection(conString);
    con.Open();
    cmd = new SqlCommand(s, con);
    reader = cmd.ExecuteReader();

    the error massage says its in the cmd.ExecuteReader() line that fails...

    have checked all names and they match with the names in the DB.
    Anyone know what can be the problem?

  2. #2
    Join Date
    Feb 2005
    Location
    Denmark
    Posts
    742

    Re: The multi-part identifier could not be bound.

    Code:
    string s = "Select maxLicenses from LicenseList where programName = " + program;
    You're missing the sql string delimiters for the "s" variable's content.

    Something like this it would seem
    Code:
    string s = "Select maxLicenses from LicenseList where programName = '" + program + "'";
    (notice the ekstra ' in the string, which is what SQL considers string delimiters)

  3. #3
    Join Date
    Sep 2010
    Posts
    2

    Re: The multi-part identifier could not be bound.

    thanks...
    its working now...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured