-
Feb 9th, 2007, 03:48 PM
#1
Thread Starter
Fanatic Member
SQl Statement returns value "System.Byte[]"
I have a sql select, and some of the fields have return value of "System.Byte[]". Fields are all character and they all have values. Can anyone explain what this means? Thank you.
-
Feb 11th, 2007, 03:50 AM
#2
Frenzied Member
Re: SQl Statement returns value "System.Byte[]"
snufse:
It is kind of hard for anyone to speculate about your SQL select statement without seeing your code.
Also, it might be helpful to know what type of database you are using.
-
Feb 12th, 2007, 08:22 AM
#3
Thread Starter
Fanatic Member
Re: SQl Statement returns value "System.Byte[]"
I am connecting to db2 retrieving a single record.
Here is the code:
VB Code:
Dim MyConnection As Odbc.OdbcConnection = New Odbc.OdbcConnection
MyConnection.ConnectionString = "Driver={Client Access ODBC Driver (32-bit)};System=vgsys400;Uid=vgwprja;Pwd=ammt7584;"
MyConnection.Open()
Dim MyCommand As Odbc.OdbcCommand = New OdbcCommand
MyCommand.CommandText = "SELECT YAALPH from VGIPRDHRP.F060116 where YAAN8 =" + EmpCode.ToString
MyCommand.CommandType = CommandType.Text
MyCommand.ExecuteScalar()
Dim MyAdapter As New Odbc.OdbcDataAdapter
MyAdapter.SelectCommand = MyCommand
Dim MyDataSet As New DataSet
Dim MyDataTable As New DataTable
MyAdapter.Fill(MyDataTable)
TextBox1.Text = MyDataTable.Rows(0).Item(0).ToString
MyConnection.Close()
Last edited by si_the_geek; Feb 12th, 2007 at 10:46 AM.
Reason: added vbcode tags
-
Feb 12th, 2007, 12:32 PM
#4
Thread Starter
Fanatic Member
Re: SQl Statement returns value "System.Byte[]"
Solution:
When connecting to db2 and selecting data and a field value is represented as binary or hexdecimal data is normally not translated. Following will solve this problem. In the connection string insert following: "Translate=1".
So my complete connection string now reads:
MyConnectionString = "Driver={Client Access ODBC Driver (32-bit)}; System=vgsys400; Translate=1; Uid=vgwprja; Pwd=ammt7584;"
This will solve the problem.
-
Jul 24th, 2017, 09:20 AM
#5
New Member
Re: SQl Statement returns value "System.Byte[]"
10 years later, you saved the day for me
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|