|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DataTable and SelectHello.
I have a DataTable which contains two columns (BEZEICH and PERSON_L). BEZEICH is of the type string and PERSON_L of the type byte[] (Property DataType of the columns). Now, I have to do a select on this Table. I try it on the fallowing way: oTable:Select("BEZEICH='test' and PERSON_L='1'") When I do this, there will be a System.Data.EvaluateException - The operation "=" cannot at system.byte[] and system.string to be accomplished. Can anybody help me, I does I have to write the select-Condition? Thanks Thomas Hi Thomas,
Why do you have a byte array data type for second column? -- Show quoteMiha Markic [MVP C#, INETA Country Leader for Slovenia] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ "Thomas Kehl" <t.kehl (at) heeb.com> wrote in message news:44da2dfe$1_2@news.bluewin.ch... > Hello. > > I have a DataTable which contains two columns (BEZEICH and PERSON_L). > BEZEICH is of the type string and PERSON_L of the type byte[] (Property > DataType of the columns). Now, I have to do a select on this Table. I try > it on the fallowing way: > > oTable:Select("BEZEICH='test' and PERSON_L='1'") > > When I do this, there will be a > System.Data.EvaluateException - The operation "=" cannot at system.byte[] > and system.string to be accomplished. > > Can anybody help me, I does I have to write the select-Condition? > > Thanks > Thomas > Hello Thomas Kehl" t.kehl (at) heeb.com,
Depending on the actual data type of PERSON_L, you might find that using the CONVERT() function inside the expression will help. See the documentation of the syntax on the DataColumn.Expression property for the complete syntax. Like Miha said, the problem is likely to be why Person_L is a byte[] (perhaps the database type is an image, varbinary or text field?) Converting it in the expression might help but byte[] doesn't convert well in an expression. Are you sure that byte[] is the data type you expected? Thanks, Shawn Wildermuth Speaker, Author and C# MVP http://adoguy.com Show quote > Hello. > > I have a DataTable which contains two columns (BEZEICH and PERSON_L). > BEZEICH is of the type string and PERSON_L of the type byte[] > (Property DataType of the columns). Now, I have to do a select on this > Table. I try it on the fallowing way: > > oTable:Select("BEZEICH='test' and PERSON_L='1'") > > When I do this, there will be a > System.Data.EvaluateException - The operation "=" cannot at > system.byte[] > and system.string to be accomplished. > Can anybody help me, I does I have to write the select-Condition? > > Thanks > Thomas Thomas,
Maybe BEZEICH[0] = xx and BEZEICH[1] etc where xx is the byte value will help, but as the others, I find this strange, Cor Show quote "Thomas Kehl" <t.kehl (at) heeb.com> schreef in bericht news:44da2dfe$1_2@news.bluewin.ch... > Hello. > > I have a DataTable which contains two columns (BEZEICH and PERSON_L). > BEZEICH is of the type string and PERSON_L of the type byte[] (Property > DataType of the columns). Now, I have to do a select on this Table. I try > it on the fallowing way: > > oTable:Select("BEZEICH='test' and PERSON_L='1'") > > When I do this, there will be a > System.Data.EvaluateException - The operation "=" cannot at system.byte[] > and system.string to be accomplished. > > Can anybody help me, I does I have to write the select-Condition? > > Thanks > Thomas > |
|||||||||||||||||||||||