Hardcoded database name in generated code

Hardcoded database name in generated code

Postby gchattin » Fri 12 Nov 2010 23:41

Hi,
I've got a project that uses a different database for production and test. I'm connecting via a Devart.Data.PostgreSql.PgSqlConnection. I've included code that changes the ConnectionString, Port, UserId, Host and Database properties prior to connecting. Outside of the Update function it seems like I am successfully connecting to the correct DB and I'm able to query data etc. However when I use Update I get an exception indicating that cross database queries are not supported. I looked around and found that in some of the auto-generated code in .Designer.vb actually has the name of the default database (that is filled out in the designer) hardcoded into the strings for the Update function (and others):

Me.PgSqlCommand11.CommandText = "INSERT INTO """.""""."""" ...

The above is my redaction of course, the actual code has the actual DB name right in the string. I've globally found the DBName and removed it and gotten the code to work, but I would like to avoid altering generated code. Is there any way to make the generated code DB name agnostic?

Thanks,
Greg
gchattin
 
Posts: 2
Joined: Fri 12 Nov 2010 22:49

Postby gchattin » Fri 12 Nov 2010 23:50

Oops, forgot the driver version

Windows XP
Visual Studio 2010
.NET 4.0
Devart.Data.PostgreSql 4.95.152.0
gchattin
 
Posts: 2
Joined: Fri 12 Nov 2010 22:49

Postby StanislavK » Mon 15 Nov 2010 17:26

As far as I can understand, you are working with typed DataSets; am I correct? Thank you for your feedback, we will analyze the possibility of removing the database name from the generated SQL.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Postby StanislavK » Fri 10 Dec 2010 12:59

We have fixed the problem with the hard-coded database name. The fix will be available in the nearest build of dotConnect for PostgreSQL.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Postby StanislavK » Fri 17 Dec 2010 10:31

We have released the new 5.0.69 version of dotConnect for PostgreSQL where these changes are available. The new build can be downloaded from
http://www.devart.com/dotconnect/postgresql/download.html
(the trial version) or from Registered Users' Area (for users with active subscription only):
http://secure.devart.com/

For more information about the fixes and improvements available in dotConnect for PostgreSQL 5.0.69, please refer to
http://www.devart.com/forums/viewtopic.php?t=19795
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48


Return to dotConnect for PostgreSQL