I have a procedure
TempSalesUpdateID which gets all ProductName's column in TempSales table and set it's corresponding ProductID.
ALTER PROCEDURE [dbo].[TempSalesUpdateID] AS UPDATE T SET T.ProductID = P.ProductID FROM TempSales T INNER JOIN Products P ON P.PN=T.ProductName
When I execute it through SQL Server Management Studio it runs perfectly: when it finds a corresponding ID, it fills ProductID column, otherwise leaves it NULL.
When I run it from my C# Windows Form Application, it puts almost random numbers instead of leaving NULL (the ones which doesn't have a corresponding ID).
I say almost because: 13098 rows have value 1 instead of NULL, 14742 rows have value 2 instead of NULL, 13601 value 3, etc.
Could you please help me? I'm really lost here