While passing datatable as input to a stored procedure using Non execute query it is throwing error.Execute Non Query: The type of column 'CountryNameDesc' is not supported. The type is 'Object'

while passing datatable as input to a stored procedure using Non execute query it is throwing error.Execute Non Query: The type of column ‘CountryNameDesc’ is not supported. The type is ‘Object’

2 Likes

How are you generating your datatable? Looks like you need to convert that column to string values first.

1 Like

what are the inputs for your stored procedure?
Make sure it is matching the data types of stored procedure.

Regards,
Karthik Byggari

1 Like

Hi @356212

Can you show more details to easily address the issue. Thanks

cheers :smiley:

Happy learning :smiley:

3 Likes

@356212,

The object datatype is not supported by the SQL, check below table for All Data Types between .net and SQL.

SQL Server data type          CLR data type (SQL Server)    CLR data type (.NET Framework)  
varbinary                     SqlBytes, SqlBinary           Byte[]  
binary                        SqlBytes, SqlBinary           Byte[]  
varbinary(1), binary(1)       SqlBytes, SqlBinary           byte, Byte[] 
image                         None                          None

varchar                       None                          None
char                          None                          None
nvarchar(1), nchar(1)         SqlChars, SqlString           Char, String, Char[]     
nvarchar                      SqlChars, SqlString           String, Char[] 
nchar                         SqlChars, SqlString           String, Char[] 
text                          None                          None
ntext                         None                          None

uniqueidentifier              SqlGuid                       Guid 
rowversion                    None                          Byte[]  
bit                           SqlBoolean                    Boolean 
tinyint                       SqlByte                       Byte 
smallint                      SqlInt16                      Int16  
int                           SqlInt32                      Int32  
bigint                        SqlInt64                      Int64 

smallmoney                    SqlMoney                      Decimal  
money                         SqlMoney                      Decimal  
numeric                       SqlDecimal                    Decimal  
decimal                       SqlDecimal                    Decimal  
real                          SqlSingle                     Single  
float                         SqlDouble                     Double  

smalldatetime                 SqlDateTime                   DateTime  
datetime                      SqlDateTime                   DateTime 

*sql_variant                   None                          Object*  
User-defined type(UDT)        None                          user-defined type     
table                         None                          None 
cursor                        None                          None
timestamp                     None                          None 
xml                           SqlXml                        None
1 Like

Input to my stored proceure is a user defined table type(@tblCastemplate). having columns ‘[CountryNameDesc]’(varchar(200),’[IsoAlphaCode2]‘varchar(200),’[RiskAreas]’(varchar(100).
in Execute non query I’m passing the sp name the input parameter as ‘@tblCastemplate’ -In-DataType-dt_Main(it is the datatable which I need to pass to the SP)

1 Like

@356212 Hi Did you find the solution for this? We are experiencing a similar problem.

Regards,
Hitesh M. Jeswani