PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET Character special in ADO ConnectionString.

Reply

Character special in ADO ConnectionString.

 
Thread Tools Rate Thread
Old 18-09-2006, 07:23 PM   #1
Jefferson Valim
Guest
 
Posts: n/a
Default Character special in ADO ConnectionString.


Hi,

we have a function that defines the password of the user access the data
base. This function was written initially in Delphi and the access to the
data base is ADO. In this environment the access is made without problems.
In C# with ADO.net when attributing the password is returned the following
error: Format of the initialization string you donate not conform you
specification starting at index 89.

Code example:
string sConn = "Data Source=10.28.0.6;Initial Catalog=dsMatriz;Persist
Security Info=False;User ID=teste;Password={0}";
byte[] b = new byte[] { 9, 13, 10, 28};
sConn = string.Format(sConn, UTF8Encoding.UTF8.GetString(b));
SqlConnection conn = new SqlConnection();
conn.ConnectionString = sConn; // Exception. Format of the initialization
string does not conform to specification starting at index 89.
conn.Open();

Any idea about this error?

Thanks,

Jefferson Valim
JBS Group
Brazil


  Reply With Quote
Old 19-09-2006, 09:08 AM   #2
Miha Markic [MVP C#]
Guest
 
Posts: n/a
Default Re: Character special in ADO ConnectionString.

Hi Jefferson,

Try with SqlConnectionStringBuilder instead.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"Jefferson Valim" <jmvalim@newsgroups.nospan> wrote in message
news:%23LpyH%2302GHA.3656@TK2MSFTNGP04.phx.gbl...
> Hi,
>
> we have a function that defines the password of the user access the data
> base. This function was written initially in Delphi and the access to the
> data base is ADO. In this environment the access is made without problems.
> In C# with ADO.net when attributing the password is returned the following
> error: Format of the initialization string you donate not conform you
> specification starting at index 89.
>
> Code example:
> string sConn = "Data Source=10.28.0.6;Initial Catalog=dsMatriz;Persist
> Security Info=False;User ID=teste;Password={0}";
> byte[] b = new byte[] { 9, 13, 10, 28};
> sConn = string.Format(sConn, UTF8Encoding.UTF8.GetString(b));
> SqlConnection conn = new SqlConnection();
> conn.ConnectionString = sConn; // Exception. Format of the initialization
> string does not conform to specification starting at index 89.
> conn.Open();
>
> Any idea about this error?
>
> Thanks,
>
> Jefferson Valim
> JBS Group
> Brazil
>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off