Search found 171 matches

by JORGEMAL
Tue 27 Nov 2012 01:27
Forum: dotConnect for PostgreSQL
Topic: Transport channel is closed
Replies: 9
Views: 4000

Transport channel is closed

We have a kind of long process which performs several operations on several database tables: insert, update and delete. Originally, such a process was designed without transactions in mind but I see that it is a good idea to include them, so I added the TransactionScope class. Now I am receiving an error message telling me that the "Transport channel is closed". I investigated a bit about it and I see that it could refer to a timeout in the transaction process, so I set it to zero as documented in MSDN as follows:

using (TransactionScope trnScope = new TransactionScope(TransactionScopeOption.Required, TimeSpan.Zero))

But the error stil appears. During the process, connections are opened and closed every time a database operationis performed, and such operations are implemented as methods in different classes. I am really lost with this issue so I want to ask for guidance to help me fix this situation. The overall process is structured as follows:

protected void MainControl()
{
using (TransactionScope trnScope = new TransactionScope(TransactionScopeOption.Required, TimeSpan.Zero))
{
process_01;
process_02;
process_03;
process_04;
process_05;
while (condition is true)
{
process_06;
process_07;
process_08;
process_09;
}
process_10;
process_11;
process_123;

if (no error is found)
trnScope.Complete();
}
}

Where each process calls one or more methods in a class library, each method performs operations to the database, and each operation opens and closes its own connection. There are no TransactionScope objects within each of the process, but only one as shown above.

We are using PostgreSQL 9.1 and dotConnect for PostgreSQL 6.0.6.0
I will very much appreciate any comment.

Respectfully,
Jorge Maldonado
by JORGEMAL
Wed 05 Sep 2012 16:23
Forum: dotConnect for PostgreSQL
Topic: How to generate XSD files
Replies: 1
Views: 1134

How to generate XSD files

I am totally new to XSD files and I need to create one for our PostgreSQL database, or part of it. Am I asking this question in the correct place? If so, I will very much appreciate any information about this issue.

Respectfully,
Jorge Maldonado
by JORGEMAL
Wed 27 Jun 2012 16:02
Forum: dotConnect for PostgreSQL
Topic: Setting the provider's connection string at run time
Replies: 16
Views: 5538

Re: Setting the provider's connection string at run time

I decided to continue testing my project and this is what I found.
The class that implements to roles that is referenced in the web.config's Role Manager section defines the database name within the overriden Initialize method using a session variable which is defined in the Session_Start event of the Global.asax. It seems that this overriden Initialize method is run firstly before the Session_Start event is fired so my Session variable was empty. I changed this behavior setting the database name in another way and now everything is working just fine.
Thanks for your support and for adding this feature.

Respectfully,
Jorge Maldonado
by JORGEMAL
Thu 21 Jun 2012 00:37
Forum: dotConnect for PostgreSQL
Topic: Setting the provider's connection string at run time
Replies: 16
Views: 5538

Re: Setting the provider's connection string at run time

Are there any news about this issue?

Regards,
Jorge Maldonado
by JORGEMAL
Fri 15 Jun 2012 16:57
Forum: dotConnect for PostgreSQL
Topic: Setting the provider's connection string at run time
Replies: 16
Views: 5538

Re: Setting the provider's connection string at run time

I am getting an error message that I include below. I am not using a namespace, the "Grupos" class is defined directly in the App_Code folder. I am using the same approach with the membership provider and it works perfectly.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Object reference not set to an instance of an object.
Source Error:
Line 69: <providers>
Line 70: <clear/>
Line 71: <add name="AspNetPgSqlRoleProvider" type="Grupos" connectionStringName="eUsuarioConnString" description="dotConnect for PostgreSQL role provider" applicationName="/"/>
Line 72: </providers>
Line 73: </roleManager>

Source File: D:\Visual Studio 2010 Projects\ePYMES\web.config Line: 71
by JORGEMAL
Mon 11 Jun 2012 21:14
Forum: dotConnect for PostgreSQL
Topic: Setting the provider's connection string at run time
Replies: 16
Views: 5538

Re: Setting the provider's connection string at run time

It worked, I was taking a wrong approach.
I need to do the same with the roles but I have not been able to succeed. I see that my problem is with the web.config in the provider's section of the roleManager definition; the "type" parameter of the provider´s name is a bit different than that in the membership section. Would you give me an idea of how to solve it?

With respect,
Jorge Maldonado
by JORGEMAL
Thu 07 Jun 2012 16:47
Forum: dotConnect for PostgreSQL
Topic: Setting the provider's connection string at run time
Replies: 16
Views: 5538

Re: Setting the provider's connection string at run time

I have been testing this new feature with some trouble. Here is what I do.
Firstly, I inherit the PgSqlMembershipProvider to my class and that way I am able to set the connectionString property you implemented. After that, I tried 2 approaches to create a user: Membership.CreateUser and base.CreateUser.

What I think is that I should use the base.CreateUser method because I see that the Membership.CreateUser still gets information about the connection string from the membership section in web.config. When I use the Membership.CreateUser method I get an error as follows (message and stack):

An exception occurred. Please contact your administrator.

at Devart.Common.Web.Providers.DbMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object userId, MembershipCreateStatus& status)
at System.Web.Security.Membership.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status)
at System.Web.Security.Membership.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, MembershipCreateStatus& status)
at Usuarios.Inserta(String& strMensaje, String strOrigen) in d:\Visual Studio 2010 Projects\ePYMES\App_Code\Usuarios.cs:line 114

So, I decided to use base.CreateUser and this is a sample of my code. No exception is thrown but I get a MembershipCreateStatus of InvalidPassword. If I use the base.CreateUser method, are the parameters in the web.config's membership section taken into account? Why do I get the InvalidPassword status and how can I get a Success status? Do I need to set additional properties? I see that most of them are read-only. I will very much appreciate your advice.

Code: Select all

public class Usuarios : PgSqlMembershipProvider
{
    // Here go the properties.

    public void Inserta(ref String strMensaje, String strOrigen)
    {
        MembershipCreateStatus Estatus;
        String strConn = "";
        Object objUserID = String.Empty;

        try
        {
            // I get a connection string name from web.config based on the user logged on.
            strConn = ConnStrings.ObtenerConnString_ePYMES();

            // I get the connection string parameters of the connection string name.
            strConn = System.Configuration.ConfigurationManager.ConnectionStrings[strConn].ToString();

            // I add the dababase name to the connection string. Our app connects to different databases with the same schema.
            strConn += ";Database=" + HttpContext.Current.Session["sesBaseDatos"];

            // I set the connectionString property of the PgSqlMembershipProvider.
            base.connectionString = strConn;

            // The user is created.
            base.CreateUser(this.NombreUsuario, this.ClaveAcceso, this.CorreoElectronico, this.PreguntaSecreta, this.Respuesta, true,objUserID, out Estatus);

            // Check for the status of the create user operation.
            switch (Estatus)
            {
                case MembershipCreateStatus.Success:
                    strMensaje += "SU CUENTA DE USUARIO SE HA CREADO SATISFACTORIAMENTE.";
                    break;
                case MembershipCreateStatus.DuplicateEmail:
                    strMensaje += "LA DIRECCION E CORREO ELECTRONICO QUE DESEA REGISTRAR ";
                    strMensaje += "YA EXISTE EN LA BASE DE DATOS. INTENTE CON OTRA DIFERENCTE.";
                    break;
                case MembershipCreateStatus.DuplicateUserName:
                    strMensaje += "EL NOMBRE DE USUARIO YA EXISTE EN NUESTRO SISTEMA, ";
                    strMensaje += "SELECCIONE OTRO E INTENTE NUEVAMENTE.";
                    break;
                case MembershipCreateStatus.InvalidAnswer:
                    strMensaje += "LA RESPUESTA A LA PREGUNTA SECRETA ES INVALIDA, ES POSIBLE ";
                    strMensaje += "QUE CONTENGA CARACETRES NO PERMITIDOS.";
                    break;
                case MembershipCreateStatus.InvalidEmail:
                    strMensaje += "LA DIRECCION DE CORREO ELECTRONICO ES INVALIDA, VERIFIQUE QUE ";
                    strMensaje += "SE HAYA ALIMENTADO EN EL FORMATO CORRECTO.";
                    break;
                case MembershipCreateStatus.InvalidPassword:
                    strMensaje += "LA CLAVE DE ACCESO ES INVALIDA. DEBE CONTENER POR LO MENOS ";
                    strMensaje += Convert.ToString(Membership.MinRequiredPasswordLength) + " CARACTERES.";
                    break;
                case MembershipCreateStatus.InvalidQuestion:
                    strMensaje += "LA PREGUNTA SECRETA ES INVALIDA, ES POSIBLE ";
                    strMensaje += "QUE CONTENGA CARACTERES NO PERMITIDOS.";
                    break;
                case MembershipCreateStatus.InvalidUserName:
                    strMensaje += "EL NOMBRE DE USUARIO ES INVALIDO, ";
                    strMensaje += "VERIFIQUE QUE LO HAYA ALIMENTADO CORRECTAMENTE. ";
                    break;
                case MembershipCreateStatus.DuplicateProviderUserKey:
                    strMensaje += "EL IDENTIFICADOR DE USUARIO YA EXISTE EN LA BASE DE DATOS, ";
                    strMensaje += "INTENTE SU REGISTRO CON OTRO NOMBRE DE USUARIO.";
                    break;
                case MembershipCreateStatus.InvalidProviderUserKey:
                    strMensaje += "EL IDENTIFICADOR DE USUARIO QUE SE HA GENERADO ES INVALIDO, ";
                    strMensaje += "INTENTE SU REGISTRO CON OTRO NOMBRE DE USUARIO. ";
                    break;
                case MembershipCreateStatus.UserRejected:
                    strMensaje += "NO FUE POSIBLE CREAR LA CUENTA DE USUARIO, ";
                    strMensaje += "INTENTE SU REGISTRO CON OTRO NOMBRE DE USUARIO.";
                    break;
                case MembershipCreateStatus.ProviderError:
                    strMensaje += "HA OCURRIDO UN ERROR DESCONOCIDO, ";
                    strMensaje += "INTENTE SU REGISTRO CON OTRO NOMBRE DE USUARIO.";
                    break;
            }
        }
        catch (Exception error)
        {
            strMensaje += error.StackTrace;
        }
    }
}
by JORGEMAL
Tue 15 May 2012 15:19
Forum: dotConnect for PostgreSQL
Topic: Setting the provider's connection string at run time
Replies: 16
Views: 5538

Re: Setting the provider's connection string at run time

It is great news !!!

Does this mean that it will be possible to directly get/set the connection string for the providers just by inheriting PgSqlMembershipProvider and/or PgSqlRoleProvider classes?

I really appreciate your support and effort for making developer's lives easier (and happier).

Respectfully,
Jorge Maldonado
by JORGEMAL
Wed 09 May 2012 23:34
Forum: dotConnect for PostgreSQL
Topic: Setting the provider's connection string at run time
Replies: 16
Views: 5538

Re: Setting the provider's connection string at run time

I have seen that setting a membership provider connectionstring at run-time is not a common procedure, I have not found very much information about it; nevertheless, what you suggest is a good choice. Below is a brief description of what I am doing and I would like you to tell me if I am correct.

Devart's pgSqlMembershipProvider inherits from .NET MembershipProvider and implements its own methods being "Initialize" one of them, which is precisely the one I need to update (override and extend) in order to set the provider's connectionstring at run-time. Is this correct?

What is getting me a bit confused is the following line of code from the site you recommended me to get a solution, where "_sqlConnectionString" is a public field according to the MSDN documentation:

Membership.Provider.GetType().GetField("_sqlConnectionString", BindingFlags.Instance | BindingFlags.NonPublic)

Where do I get such a public field from? Is it a field that I need to implement?

I know this an ASP.NET issue and I apologize for asking help from you, but as I told you above, I have been looking around for information about this issue for some weeks without response and it is really important for me to get a solution as soon as possible, and because the Devart team are experts about this matter, I have felt free to ask for your suport.

Respectfully,
Jorge Maldonado
by JORGEMAL
Tue 08 May 2012 16:19
Forum: dotConnect for PostgreSQL
Topic: Setting the provider's connection string at run time
Replies: 16
Views: 5538

Re: Setting the provider's connection string at run time

How do I inherit PgSqlMembershipProvider and PgSqlRoleProvider into my provider implementation?
I can inherit MembershipProvider and RoleProvider from the System.Web.Security namespace, but I cannot find PgSqlMembershipProvider and PgSqlRoleProvider.
Is this the approach you refer to ?

With respect,
Jorge Maldonado
by JORGEMAL
Fri 27 Apr 2012 21:34
Forum: dotConnect for PostgreSQL
Topic: Setting the provider's connection string at run time
Replies: 16
Views: 5538

Setting the provider's connection string at run time

I wonder if this is a question for your or an ASP.NET issue. Please let me know.
I need to change/set the connection string of the providers in the Membership and RoleManager section in the web.config at run time. I only have one provider in each section which are PgSqlMembershipProvider and PgSqlRoleProvider. I have tried getting the connection string using Membership.Provider but it does not appear, I can see all of the parameters (name, type, description, passwordFormat, enablePasswordRetrieval, etc) except the one for connection string. Is this task possible? Can a string connection be specified instead of a connection name?

Respectfully,
Jorge Maldonado
by JORGEMAL
Fri 06 Apr 2012 21:38
Forum: dotConnect for PostgreSQL
Topic: Running a query that uses pg_trgm EXTENSION
Replies: 3
Views: 3269

Did you write C# and tested the SIMILARITY function?
If so, would you show me your code so I can go over it and see what I am doing wrong? I have been testing for a long time and I keep getting the message that says that the "functionality(character varying, unknown) function does not exist".

I made a mistake when I say that I tested in Visual Studio, I mean pgAdmin III (and a tool called PostgreSQL Maestro too). Nevertheless, I just tested in the Visual Studio SQL Panel and it failed, I get the same error message.

I thank you in advace for any advice.

P.S.: I tried to send a zip file with a test Visual Studio web form using the contact form but I keep getting a "Failure sending mail" message".

With respect,
Jorge Maldonado
by JORGEMAL
Tue 03 Apr 2012 15:41
Forum: dotConnect for PostgreSQL
Topic: Running a query that uses pg_trgm EXTENSION
Replies: 3
Views: 3269

Running a query that uses pg_trgm EXTENSION

I am trying to run a query that uses the "pg_trgm EXTENSION" as follows:

Code: Select all

strQuery.Append("SELECT ");
strQuery.Append("nombre, ");
strQuery.Append("similarity(nombre, '" + strArtista + "') AS similitud ");
strQuery.Append("FROM temp_artistas ");
strQuery.Append("WHERE ");
strQuery.Append("similarity(nombre, '" + strArtista + "')  1 ");
strQuery.Append("AND similarity(nombre, '" + strArtista + "') >= 0.5");
where "nombre" is a field of a table and "strArtista" is any string of characters. Neverthleless, I get a message saying that the "function similarity does not exist". Such a query runs fine in Visual Studio and in PostgreSQL Maestro. What am I missing?

PS: The extension is already created. I use dotConnect v5.70 and PostgreSQL v9.1.

Regards,
Jorge Maldonado
by JORGEMAL
Tue 20 Mar 2012 14:22
Forum: dotConnect for PostgreSQL
Topic: How to deal with 2 versions of dotConnect
Replies: 5
Views: 5191

Thanks for your reply.
I use approach (1) in our production server.
Does dotConnect for PostgreSQL v5.50 have support for PostgreSQL v9.1?

Regards,
Jorge Maldonado
by JORGEMAL
Sun 18 Mar 2012 21:35
Forum: dotConnect for PostgreSQL
Topic: How to deal with 2 versions of dotConnect
Replies: 5
Views: 5191

How to deal with 2 versions of dotConnect

I have 2 web projects in my development PC, both of them work with dotConnect for PostgreSQL 5.50. I would like to upgrade only one of the projects to dotConnect 5.80 and continue using version 5.50 with the other one. Nevertheless, I see that I cannot have both versions of dotConnect installed in my development PC. How can I maintain a project that runs with dotConnect 5.50 and another running with dotConnect 5.80?

Respectfully,
Jorge Maldonado