J
james
I am creating an connection string at runtime using decryption (crypto
libraries).
i have a very unpridictable error while assinging the generated
connection string to the connection property.
my code is something like this ...
Public Function DbconnStr(ByVal UID As String, ByVal Pwd As String, _
ByVal ServerName As String,
ByVal DbName As String) As StringBuilder
Dim str as stringbuilder
Dim UIDinfo As String =
Convert.ToBase64String(DecryptData.Decrypt(Encoding.ASCII.GetBytes(UID)))
Dim PWDinfo As String =
Convert.ToBase64String(DecryptData.Decrypt(Encoding.ASCII.GetBytes(Pwd)))
Str.Append("Server=")
Str.Append(ServerName)
Str.Append(";Database=")
Str.Append(DbName)
Str.Append(";User ID=")
Str.Append(UIDinfo)
Str.Append(";password=")
Str.Append(PWDinfo)
Str.Append(";Trusted_Connection=False")
Catch ex As Exception
Throw New Exception("In WASC " & ex.Message)
End Try
Return Str
End Function
the generated string ... something like
--"Server=GVA21943\SQLSERVER;Database=Northwind;User
ID=WASCuser;password=welcome;Trusted_Connection=False"
the error is ---Format of the initialization string does not conform
to specification starting at index 61. -- which is always the end of
user ID.
If i hard code the same value i am thru the connection.
Also i noticed an additional char when i find the length of the string
generated for UIDinfo and PWDinfo.
so when i delete the last character generated ... again the connection
is thru at runtime.
But without deleting when i print the connectstring ... i don't find
that character ...its invisible....
pls help me to know y that invisible character (at the end of the
generated string for UIDinfo and PWDinfo) giving me this nasty error.
thanks.
libraries).
i have a very unpridictable error while assinging the generated
connection string to the connection property.
my code is something like this ...
Public Function DbconnStr(ByVal UID As String, ByVal Pwd As String, _
ByVal ServerName As String,
ByVal DbName As String) As StringBuilder
Dim str as stringbuilder
Dim UIDinfo As String =
Convert.ToBase64String(DecryptData.Decrypt(Encoding.ASCII.GetBytes(UID)))
Dim PWDinfo As String =
Convert.ToBase64String(DecryptData.Decrypt(Encoding.ASCII.GetBytes(Pwd)))
Str.Append("Server=")
Str.Append(ServerName)
Str.Append(";Database=")
Str.Append(DbName)
Str.Append(";User ID=")
Str.Append(UIDinfo)
Str.Append(";password=")
Str.Append(PWDinfo)
Str.Append(";Trusted_Connection=False")
Catch ex As Exception
Throw New Exception("In WASC " & ex.Message)
End Try
Return Str
End Function
the generated string ... something like
--"Server=GVA21943\SQLSERVER;Database=Northwind;User
ID=WASCuser;password=welcome;Trusted_Connection=False"
the error is ---Format of the initialization string does not conform
to specification starting at index 61. -- which is always the end of
user ID.
If i hard code the same value i am thru the connection.
Also i noticed an additional char when i find the length of the string
generated for UIDinfo and PWDinfo.
so when i delete the last character generated ... again the connection
is thru at runtime.
But without deleting when i print the connectstring ... i don't find
that character ...its invisible....
pls help me to know y that invisible character (at the end of the
generated string for UIDinfo and PWDinfo) giving me this nasty error.
thanks.