Re: [sqlite] sqlite Exception System.InvalidCastException: Specified cast is not valid.
The best place to get answers to .NET-related issues with the System.Data.SQLite provider is: http://sqlite.phxsoftware.com I've got plenty of forums over there so we don't clutter up the list with wrapper issues unrelated to the engine itself. Robert Simpson -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Joel Lucsy Sent: Wednesday, June 17, 2009 5:53 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] sqlite Exception System.InvalidCastException: Specified cast is not valid. On Wed, Jun 17, 2009 at 2:18 AM, Seysan wrote: > I get the Exception there! sqlite Exception > System.InvalidCastException: Specified cast is not valid. > > The GetFieldType Shows: Systes.Byte[] Couldn't find my code where I've done it at. Tho I did find that I used a ExecuteScalar() that returns byte[]. Could it be that the field is null? Also, what version of System.Data.Sqlite.dll are you running? I use 1.0.60 but haven't tested 1.0.61 yet. -- Joel Lucsy "The dinosaurs became extinct because they didn't have a space program." -- Larry Niven ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] sqlite Exception System.InvalidCastException: Specified cast is not valid.
On Wed, Jun 17, 2009 at 2:18 AM, Seysan wrote: > I get the Exception there! sqlite Exception > System.InvalidCastException: Specified cast is not valid. > > The GetFieldType Shows: Systes.Byte[] Couldn't find my code where I've done it at. Tho I did find that I used a ExecuteScalar() that returns byte[]. Could it be that the field is null? Also, what version of System.Data.Sqlite.dll are you running? I use 1.0.60 but haven't tested 1.0.61 yet. -- Joel Lucsy "The dinosaurs became extinct because they didn't have a space program." -- Larry Niven ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] sqlite Exception System.InvalidCastException: Specified cast is not valid.
This is the Code in C#: SQLiteDataReader rdr; SQLiteCommand contentCommand; String cmd = String.Format("SELECT filename,content,filesize FROM documents WHERE did={0}",did); contentCommand = sqlconn.CreateCommand(); contentCommand.CommandText = cmd; rdr = contentCommand.ExecuteReader(); rdr.Read(); MessageBox.Show(rdr.GetFieldType(1).ToString()); MessageBox.Show(rdr.FieldCount.ToString()); -->long len = rdr.GetBytes(1, 0, null, 0, 0); Byte[] buf = new Byte[len]; rdr.GetBytes(1, 0, buf, 0,(int) len); I get the Exception there! sqlite Exception System.InvalidCastException: Specified cast is not valid. The GetFieldType Shows: Systes.Byte[] What is it that I'm doing wrong? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users