Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

invalidcastexception iconvertiable

Status
Not open for further replies.

kbromwich

Programmer
Feb 17, 2004
6
AU
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top