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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CLR Error!

Status
Not open for further replies.

Antzz

Programmer
Jan 17, 2001
298
US
Hi Guys,
Any idea of what this error might mean::
----------------------------------------------------------
Server: Msg 6522, Level 16, State 1, Procedure [S. proc name], Line 0
A .NET Framework error occurred during execution of user-defined routine or aggregate "[S. Proc Name]":
System.Data.SqlClient.SqlException: Line 0: Length or precision specification 0 is invalid.
System.Data.SqlClient.SqlException:
at Microsoft.SqlServer.Server.SmiEventSink_Default.ProcessMessagesAndThrow(Boolean ignoreNonFatalMessages)
at Microsoft.SqlServer.Server.SqlPipe.Send(SqlDataReader reader)
at [Namespace qualified CLR method]

-------------------------------------------------------

The SP has a nvarchar type parameter being passed and the CLR equivalent method accepts a string as a parameter.

Thanks

A
 
If I had to guess, I would say that you did not specify the length of the nvarchar parameter when creating the parameter object.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Hi George,
This is what I am doing:

1) My CLR has a method which accepts a string(name/value pair)
2) The CLR translates this string to a SQL query internally and executes it. At this point I am using SqlCommand.CommandText to specify the SQL string
3) My SP has a parameter(nvarchar(1000)), which equates to the name/value parameter to the method in the CLR routine.

I realise that I have not defined the parameter object but do I still need to define it if I am using the CommandText property to specify my SQL?

A
 
Oh Yes. The Query actually errors out when data is returned from the server. When there is no data, it is just fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top