Byte Array, Datagrid

  • Thread starter Selva Chinnasamy
  • Start date
S

Selva Chinnasamy

Hi, I am reading Byte Array from MS-Access table, which I wanted to display
in the datagrid. Right now its displayed as "Byte[] array". How can I
display the actual string.

Any help!

Selva
 
C

Chris

Selva said:
Hi, I am reading Byte Array from MS-Access table, which I wanted to display
in the datagrid. Right now its displayed as "Byte[] array". How can I
display the actual string.

Any help!

Selva

Can you show some of your code.

Chris
 
G

Guest

Chris,

Column Text is Binary type. Because we want to store unicode's also this was
created 7 years back where access doesnt store it as Unicode.

strSQL = "SELECT FIXEDTEXT.FixedTextRecordID, FIXEDTEXT.Text "
strSQL &= "FROM(FIXEDTEXT) "
strSQL &= "WHERE(((FIXEDTEXT.ScreenName) = '" & m_ScreenName & "')) "
strSQL &= "ORDER BY FIXEDTEXT.FixedTextRecordID"

Dim oDA As New OleDbDataAdapter(strSQL, cnLang)
Dim oDS As New DataSet

'throw a custom exception
'AddHandler oDA.FillError, AddressOf FillError

oDA.Fill(oDS, "FIXEDTEXT")

dgdFixedText.DataSource = oDS
dgdFixedText.DataMember = "FIXEDTEXT"

Looking forward your suggestions.

Selva
 
C

Chris

Selva said:
Chris,

Column Text is Binary type. Because we want to store unicode's also this was
created 7 years back where access doesnt store it as Unicode.

strSQL = "SELECT FIXEDTEXT.FixedTextRecordID, FIXEDTEXT.Text "
strSQL &= "FROM(FIXEDTEXT) "
strSQL &= "WHERE(((FIXEDTEXT.ScreenName) = '" & m_ScreenName & "')) "
strSQL &= "ORDER BY FIXEDTEXT.FixedTextRecordID"

Dim oDA As New OleDbDataAdapter(strSQL, cnLang)
Dim oDS As New DataSet

'throw a custom exception
'AddHandler oDA.FillError, AddressOf FillError

oDA.Fill(oDS, "FIXEDTEXT")

dgdFixedText.DataSource = oDS
dgdFixedText.DataMember = "FIXEDTEXT"

Looking forward your suggestions.

Selva


Well I can think of a couple suggestions for you.

1. Do a one time convert of all the data in your Access table out of
binary to a nicer type.

2. After you pull the data into the datatable, loop through it and
convert it out of binary. Look in the help file at the encoding class
to do that.

3. Make a custom DataGridTextBoxColumn that converts it for you as it
displays it. You then will make a DataGridTableStyle and add your new
DataGridTextBoxColumn to it. There is a lot of info around on how to
make custom columns like that.

Hope it helps
chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top