Error converting data type varchar to tinyint

E

Elmo Watson

I am having all kinds of problems with a Stored Proc I'm trying to run, with
the error I'm getting above.

First - the way I'm reading it - the database EXPECTS a TinyInt - and it
thinks I'm giving it a varchar input - right?

If that's so - there's only one field in the table that uses tinyInt - and
I've double checked:

cmd.Parameters.Add(New OleDbParameter("@idMarketingRepType",
OleDbType.TinyInt))
cmd.Parameters("@idMarketingRepType").Value = intMktgType ' <-------this is
DEFINITELY an 8

With 7 insertable fields:
1 is a SmallInt
1 is a TinyInt
2 are varchars
3 are Bit fields (because of using a UDL for the conn string, I'm having to
use OleDB instead of the SQL client, so I'm using this format:

cmd.Parameters.Add(New OleDbParameter("@Percent_Yn", OleDbType.BSTR))
cmd.Parameters("@Percent_Yn").Value = intCommissionType

Another question - since these values are bits (-1 or 0) - when I dim the
datatype for these - I've been using Integer
I assume that's ok here -

the whole parameter section is here:
cmd.Parameters.Add(New OleDbParameter("@idEmployee", OleDbType.SmallInt))
cmd.Parameters("@idEmployee").Value =System.DBNull.Value ' I've tried
leaving this out completely since it's always null

cmd.Parameters.Add(New OleDbParameter("@idMarketingRepType",
OleDbType.TinyInt))
cmd.Parameters("@idMarketingRepType").Value = intMktgType

cmd.Parameters.Add(New OleDbParameter("@RepID", OleDbType.varchar,10))
cmd.Parameters("@RepID").Value = txtRepID.text

cmd.Parameters.Add(New OleDbParameter("@RepName", OleDbType.varchar,42))
cmd.Parameters("@RepName").Value = txtRepName.text

cmd.Parameters.Add(New OleDbParameter("@Percent_Yn", OleDbType.BSTR))
cmd.Parameters("@Percent_Yn").Value = intCommissionType

cmd.Parameters.Add(New OleDbParameter("@AutoRecalc_Yn", OleDbType.BSTR))
cmd.Parameters("@AutoRecalc_Yn").Value = System.DbNull.Value ' I've
tried leaving this out completely since it's always null

cmd.Parameters.Add(New OleDbParameter("@Active_Yn", OleDbType.BSTR))
cmd.Parameters("@Active_Yn").Value = intActive

I've verified all field inputs using Tracing - and if I use an inline sql
statement with hardcoded numbers, it works find.
Any ideas here, on what could be wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top