Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Stored Procedure with Parameter

$
0
0

Visual Studio 2015

Desktop App

Trying to execute a WORKING stored procedure from my app.

Here is the call...

    string SQL2 = @"[dbo].[GetBestDeliveryAddress]";
    using (SqlCommand myCommand2 = new SqlCommand(SQL2, myConnection))
    {
        myCommand2.Parameters.AddWithValue("@DeliveryID", newtix);
        myCommand2.CommandType = CommandType.StoredProcedure;
        myCommand2.ExecuteNonQuery();
    }

I get this error:

An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
Additional information: Could not find stored procedure ''

This happens whether I add the param after the SQL string or not.

@"[dbo].[GetBestDeliveryAddress] @DeliveryID";

I followed an example I found online exactly, I am a little confused why it's not working.


I'd rather live with false hope than with false despair.


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>