Data type issue

  • Hi
    I have a stored procedure that simply deletes a record for a given ID sent in.
    This is sent in from a VB.Net application. The issue is that it does not delete the record; and does not give an error. I believe is that in the table the field called 
    REPORT_INDEX, is a Bigint but what is being sent in from the textbox is a string. As you can see below I tried cast, but that did not work. Or maybe it is something else.
    Any ideas would be appreaciated
    Thanks

    My delete procedure:


    ALTER PROCEDURE [dbo].[uspDelete_Report]
    @ReportIndex VARCHAR(100)
    AS

    BEGIN
    DELETE [dbo].[Reports]
      Where [REPORT_INDEX] = @ReportIndex --Cast(@ReportIndex as bigint)
  • itmasterw 60042 - Tuesday, July 31, 2018 1:21 PM

    Hi
    I have a stored procedure that simply deletes a record for a given ID sent in.
    This is sent in from a VB.Net application. The issue is that it does not delete the record; and does not give an error. I believe is that in the table the field called 
    REPORT_INDEX, is a Bigint but what is being sent in from the textbox is a string. As you can see below I tried cast, but that did not work. Or maybe it is something else.
    Any ideas would be appreaciated
    Thanks

    My delete procedure:


    ALTER PROCEDURE [dbo].[uspDelete_Report]
    @ReportIndex VARCHAR(100)
    AS

    BEGIN
    DELETE [dbo].[Reports]
      Where [REPORT_INDEX] = @ReportIndex --Cast(@ReportIndex as bigint)

    If the VB.NET is calling the stored procedure with a string you can replicate the VB.NET call with
    EXEC [dbo].[uspDelete_Report] '1234'
    to test the stored procedure directly on the database using SSMS.
    SQL Server will do implicit conversion from a string to an integer providing the string can be converted to an integer.
    Another thing to try would be nvarchar instead of varchar but it would be helpful if you could paste in the .NET code that calls the stored procedure to the question.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply