1

I am trying to update SQL Server Agent schedules using msdb.dbo.sp_update_schedule, but when I try to call the stored procedure from code I get exceptions.

System.Data.OleDb.OleDbException: Error converting data type int to tinyint.

at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)

at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()

How can I convert a value to a tinyint?

I have tried

MyParameter.DbType = System.Data.DbType.

but there is no TinyInt available.

Community
  • 1
  • 1
Tester101
  • 8,042
  • 13
  • 55
  • 78

2 Answers2

5
MyParameter.DbType = System.Data.DbType.Byte;
poindexter12
  • 1,775
  • 1
  • 14
  • 20
2

try with

MyParameter.DbType = System.Data.DbType.Byte

because

tinyint is actually
   Integer data from 0 through 255. Storage size is 1 byte.
TalentTuner
  • 17,262
  • 5
  • 38
  • 63