Re: bytes to string conversion

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




Hi,

In my SQL Server I have a table call tbl_USER. And this table contains
for field as:

ID, mREALNAME, mUSERNAME, mPASSWQORD

I can connect sql server and retrive the data intoi the DataSet. However
the mUSERNAME, mPASSWQORD field uses binary data type.

I have to convert this binary data into the string so I can compare it.
The reason I am chossen this way is some other problem that I am having
to Encrpty to the data.


Here is my parital code that try to convert binary data into string:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

For Each CHECKROW In CHECKTABLE.Rows

Dim dBytes() As Byte = (CHECKROW("mUSERNAME"))

Dim mUSER As String
Dim enc1 As New System.Text.UTF8Encoding
Dim str1 As String = System.Text.Encoding.GetEncoding
(437).GetString(dBytes)

....
....
....
Next


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

The problem is my str1 string only have 1 character and that is the
character "N"

My user name is NIYAZI in Turkish which is the character "I" has and
small dot on top it.

Now how can I get right string after converting byte() that is value
comes from SQL Server (in a binary data type)

I try to use varbinary data type in SQL server and I still couldn't get
right information.

I will appricate if anyone show me somne light to this problem.

Thank you for reading this.

Rgds,
GC

*** Sent via Developersdex http://www.developersdex.com ***
.



Relevant Pages

  • What causes String or binary data would be truncated" error?
    ... Microsoft OLE DB Provider for SQL Server ... String or binary data would be truncated. ...
    (borland.public.delphi.database.ado)
  • Re: string or binary data would be truncated
    ... Vyas, MVP (SQL Server) ... "string or binary data would be truncated" <string or binary data would be ...
    (microsoft.public.sqlserver.server)
  • Re: Linking tables access - sql server 2005
    ... Another advantage of this method is that you don't need an ODBC setting on the local computer, ... Create a linked table to SQL Server without using a DSN ... Name of the table that you are linking to on the SQL Server database ... Function AttachDSNLessTable(stLocalTableName As String, stRemoteTableName As String, stServer As String, stDatabase As String, Optional stUsername As ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Cannot Generate SSPI Context - help
    ... I have used the following DSN-less string: ... Microsoft OLE DB Provider for SQL Server error '80004005' ... When a connection is "trusted," it means ... > How would one connect to a remote SQL Server using Windows authen? ...
    (microsoft.public.inetserver.asp.db)
  • Re: Searching for byte sequence
    ... Several lines of "text" header info followed by 10,000bytes of binary data ... like your text string) then the Find approach will work. ... If n gives me an offset in a string (that ... CString cSelect; ...
    (microsoft.public.vc.mfc)