0
Answer

invalidcastexception : iconvertiable

keith.bromwich

keith.bromwich

20y
1.9k
1
all okay using version 2 of the data access block i am trying to implement sqltransaction around severall calls to stored procedures i have set up the transactions as follows dim conn as new sqlconnection(connstring) conn.open dim transaction as sqltransaction transaction = conn.begintransaction sqlhelper.executenonquery(transaction, "a stored procedure name", sqlParameters) the sqlparameters have been defined above. if i pass the connection string instead of the transaction then all works. that is no good. i need to wrap a few stored procedures in to a transaction. when i run the line sqlhelper then this causes the error. the exact error message System.InvalidCastException: Object must implement IConvertible. at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at SqlHelper.ExecuteNonQuery(SqlTransaction transaction, CommandType commandType, String commandText, SqlParameter[] commandParameters) in C:\Development\DCRS\DataAccess\SQLHelper.vb:line 427 at SqlHelper.ExecuteNonQuery(SqlTransaction transaction, String spName, Object[] parameterValues) in C:\Development\DCRS\DataAccess\SQLHelper.vb:line 464 at DCRS.DataAccess.SpeciesDB.Save(SpeciesInfo SpeciesInfo) in C:\Development\DCRS\DataAccess\SpeciesDB.vb:line 227" it is falling over in the sqlhelper when it is to run the query. okay anyone any ideas, come accross this problem no how to fix etc cheers keith