none
Problem with DbConnectionStringBuilder class RRS feed

  • Question

  • Hi,

    I am working on ADO.NET provider. I have created my ConnectionStringBuilder class which inherits DbConnectionStringBuilder class.

    At one point, I set the DbConnectionStringBuilder.ConnectionString to my connectionString which is sent by an user application.

    My problem is, if the connection string has some special characters, e.g. if I send the value of certain key as \"xyz\"", it should treat it as "xyz" but somehow these double quotes are getting stripped off by the base class and the value for that particular tree is used as xyz.

    Can anybody suggest me the workaround to overcome this issue?

    Thanks
    ~Aniruddha
    Tuesday, June 28, 2011 12:13 PM

All replies

  • Looking at your code, if you put " \"xyz\"", what do yo get?

    Regards

    Tuesday, June 28, 2011 1:07 PM
  • Hi,

    If I put \"xyz\"" as a value to certain key, I expect my provider to consider this value as "xyz" (double quotes included). But somehow, when I try to set the ConnectionString property of DbConnectionStringBuilder class, it strips off the double quotes around xyz and the value used for that particular key is xya (w/o double quotes) which eventually gives error from the backend as it expects the double quotes along with xyz.

    Thanks

    ~Aniruddha

    Wednesday, June 29, 2011 5:24 AM
  • I was asking to use  "\"xyz\"",  not  \"xyz\""

    Regards


    Wednesday, June 29, 2011 9:42 AM
  • Thanks for your clarification, I missed the extra quotation marks mentioned.

    Actually the string I want send to the backend is of format: \"xy/z\"" hence I can not use the format provided here as it is throwing the syntax error.

    Thanks

    ~Aniruddha

    Wednesday, June 29, 2011 10:30 AM
  • I think this format can help:

     @"xy/z"

    Regards


    Wednesday, June 29, 2011 10:55 AM
  • unfortunately no! :(...

    Somehow, while setting the ConnectionString Property of DbConnectionStringBuilder class, it is stripping down the double quotes. I am stumped.

    Thanks

    ~Aniruddha 

    Wednesday, June 29, 2011 11:52 AM
  • The best way in such scenario is to debug and check how the connectionString is set.

    Thanks


    Wednesday, June 29, 2011 12:20 PM
  • The class I am talking about is a .NET class, hence there is noway I could debug it.

    Anyways, thanks for your help.

    Thanks

    ~Aniruddha

    Thursday, June 30, 2011 8:04 AM
  • AMK1985,

    you are welcome!

    Thursday, June 30, 2011 3:21 PM
  • Hi Aniruddha, how about your issue? Have you solved it? If you have any updates, could you please tell us?

     

    Good day,


    Jackie Sun [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, July 4, 2011 2:25 PM
    Moderator
  • Hi,

    No, I havent found any solution on this issue yet. I am still looking for an appropriate answer. My big concern is, why does the built in .NET class is stripping down the double quotes on its own. Mostly I will go with my own implementation rather than using dbConnectionStringBuilder class.

    Thanks

    ~Aniruddha

    Tuesday, July 5, 2011 6:04 AM