G
Guest
I need some help. I have the following code:
cmSQL = New SqlCommand("nf_AddPurchaseOrder", cnSQL)
cmsql.CommandType = CommandType.StoredProcedure
cmsql.Parameters.Add("@PurchaseOrderId", sqldbtype.varchar, 10,
"OrderNo").Value = txtPONum.Text
cmsql.Parameters.Add("@OrderDesc", sqldbtype.VarChar , 50 ,
"OrderDesc").Value = txtOrderDescription.text
cmsql.Parameters.Add("@SupplierId", sqldbtype.Int , "SupplierId").Value =
s.SupplierId
Dim b as Program
b = cmbPrograms.SelectedItem
cmsql.Parameters.Add("@ProgramId", sqldbtype.Int , "ProgramId").Value =
b.ProgramId
When the code hits either the SupplierId or the ProgramId line I get the
following error:
Cast from String "SupplierId" to type 'Integer' is not valid
My problem is that the stored procedures parameters are Int, the values I'm
passing in are also Integers. So not sure where the heck this error is coming
from. Thanks for any help.
Michael Lee
cmSQL = New SqlCommand("nf_AddPurchaseOrder", cnSQL)
cmsql.CommandType = CommandType.StoredProcedure
cmsql.Parameters.Add("@PurchaseOrderId", sqldbtype.varchar, 10,
"OrderNo").Value = txtPONum.Text
cmsql.Parameters.Add("@OrderDesc", sqldbtype.VarChar , 50 ,
"OrderDesc").Value = txtOrderDescription.text
cmsql.Parameters.Add("@SupplierId", sqldbtype.Int , "SupplierId").Value =
s.SupplierId
Dim b as Program
b = cmbPrograms.SelectedItem
cmsql.Parameters.Add("@ProgramId", sqldbtype.Int , "ProgramId").Value =
b.ProgramId
When the code hits either the SupplierId or the ProgramId line I get the
following error:
Cast from String "SupplierId" to type 'Integer' is not valid
My problem is that the stored procedures parameters are Int, the values I'm
passing in are also Integers. So not sure where the heck this error is coming
from. Thanks for any help.
Michael Lee