From: Martin <mc...@we...> - 2004-01-16 00:17:14
|
Hi, I am using .net provider 1.5 RC2. I am using vb.net code. The line that is throwing the exception is strDesciption = CType(objCMD.ExecuteScalar(), String) and the exception description is Cast from type 'Byte()' to type 'String' is not valid. I have checked that a record is being broght back. Perhaps I have the cast syntax wrong... The full code that I am using is below. If I comment the cat out and just use objCMD.ExecuteScalar() then all works fine. I am executing a stored procedure. and the full code that I am using is below for reference. cheers martin. Try Dim objConn As FirebirdSql.Data.Firebird.FbConnection = New FirebirdSql.Data.Firebird.FbConnection Dim objCMD As FirebirdSql.Data.Firebird.FbCommand = New FirebirdSql.Data.Firebird.FbCommand Dim objTran As FirebirdSql.Data.Firebird.FbTransaction objConn.ConnectionString = System.Configuration.ConfigurationSettings.AppSettings("DbConnectionString") objConn.Open() objCMD.Connection = objConn objTran = objConn.BeginTransaction() objCMD.Transaction = objTran objCMD.CommandText = "SP_EE_GET_GROUP_DESCRIPTION" objCMD.CommandType = CommandType.StoredProcedure Dim P1 As New FirebirdSql.Data.Firebird.FbParameter P1.Direction = ParameterDirection.Input P1 = objCMD.Parameters.Add("@ID", 87) Dim strDesciption As String 'Variable to hold the description string that will be returned strDesciption = CType(objCMD.ExecuteScalar(), String) <<<<<<<<<<<<<<<<<<<<--------- THROWS EXCEPTION objCMD.Dispose() objTran.Commit() objTran.Dispose() objConn.Close() Catch ex As Exception Trace.Write(ex.Message()) End Try "Carlos Guzmán Álvarez" <car...@te...> wrote in message news:400...@te...... > Hello: > > > BLOB SUB_TYPE 1 SEGMENT SIZE 80 CHARACTER SET NONE > > It's correct, which version of the .NET Data Provider are you using ?? > > I have tested this with 1.5, and runs fine: > > FbConnection connection = new FbConnection(connectionString); > connection.Open(); > > string sql = "select clob_field from test where int_field = 1"; > > FbCommand command = new FbCommand(sql, connection); > > string value = (string)command.ExecuteScalar(); > > connection.Close(); > > > > > -- > Best regards > > Carlos Guzmán Álvarez > Vigo-Spain > > > > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Firebird-net-provider mailing list > Fir...@li... > https://lists.sourceforge.net/lists/listinfo/firebird-net-provider > |