Stored Procedure call includes DB name

Posts   
 
    
Posts: 30
Joined: 08-Apr-2008
# Posted on: 29-Jun-2008 10:16:53   

On our network, we haven't got a completely separate environment for development and testing - both environments share a common database server. Due to this, we have 2 databases with different names.

Using LLBLGen, if we make a call to a stored procedure, the generated SQL seems to be calling the stored procedure in the development database rather than the test database. We've traced this to the generated code and deleting the database name prefix and re-compiling gets everything working well again. Although a search-and-destroy using the IDE removed the database name prefix, sometimes developers forget to do it after regenerating the code using LLBLGen. disappointed

The version we're using is LLBLGen Pro v2.5 Final (Sept 24th 2007).

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39871
Joined: 17-Aug-2003
# Posted on: 29-Jun-2008 11:48:04   

Please check Catalog Name overwriting in the manual, section: Application configuration through config files (and I'd upgrade to the latest build of v2.5, as you're using a build which is quite old).

Frans Bouma | Lead developer LLBLGen Pro
Posts: 30
Joined: 08-Apr-2008
# Posted on: 29-Jun-2008 12:05:34   

Otis wrote:

Please check Catalog Name overwriting in the manual, section: Application configuration through config files (and I'd upgrade to the latest build of v2.5, as you're using a build which is quite old).

Hi!

I'm using the catalog name overwriting feature, which is why I'm able to do everything else - except calling stored procedures - without modifying the generated source code. Here's a code snippet:


/// <summary>
/// Calls stored procedure 'employersDelProc'.<br/><br/>
/// 
/// </summary>
/// <param name="id">Input parameter of stored procedure</param>
/// <param name="updatedById">Input parameter of stored procedure</param>
/// <param name="adapter">The DataAccessAdapter object to use for the call</param>
/// <returns>Amount of rows affected, if the database / routine doesn't surpress rowcounting.</returns>
public static int EmployersDelProc(System.Int32 id, System.Int32 updatedById, DataAccessAdapter adapter)
{
  SqlParameter[] parameters = new SqlParameter[2];
  parameters[0] = new SqlParameter("@id", SqlDbType.Int, 0, ParameterDirection.Input, true, 10, 0, "",  DataRowVersion.Current, id);
  parameters[1] = new SqlParameter("@updated_by_id", SqlDbType.Int, 0, ParameterDirection.Input, true, 10, 0, "",  DataRowVersion.Current, updatedById);

  int toReturn = adapter.CallActionStoredProcedure("[DoJo].[dbo].[employersDelProc]", parameters);

  return toReturn;
}

I always have to take out the DB name prefix from the CallActionStoredProcedure method disappointed

BTW, by newer build, do you mean LLBLGen Pro v2.6?

-Nitin

arschr
User
Posts: 894
Joined: 14-Dec-2003
# Posted on: 29-Jun-2008 13:34:04   

BTW, by newer build, do you mean LLBLGen Pro v2.6?

v2.6 is available but there are also bug fix releases of v2.5 available to you. The latest was published 6/19/2008

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 30-Jun-2008 08:03:59   

BTW, by newer build, do you mean LLBLGen Pro v2.6?

He ment, the latest release of v.2.5