Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9001789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:28:59+00:00 2026-06-16T00:28:59+00:00

I searched through this site and found some topic about my problem but still

  • 0

I searched through this site and found some topic about my problem but still cannot make this work….

I am simply trying to retrieve data from a SQL Server database using a stored procedure.
I am passing one parameter that is a SqlDbType.Varchar(50) type, but I get back a SQL error:

Procedure or function ‘WyszukajPrzesylki’ expects parameter ‘@Nazwisko’, which was not supplied.

What am I doing wrong? Store procedure works if I test it in SSMS …

It even works when I type

SqlCommand com = new SqlCommand("WyszukajPrzesylki @Nazwisko = Example", con);

You are my last hope guys… I’ve already lost 2 days with this problem and cannot get any further… don’t have any problems with inserting and updating records using c# … just this….

So here is the code of SP

ALTER PROCEDURE [dbo].[WyszukajPrzesylki] 
-- Add the parameters for the stored procedure here
@Nazwisko varchar(50)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

-- Insert statements for procedure here
-- SELECT * FROM Przesylki WHERE (NazwiskoAdresata = @NazwiskoAdresata)
SELECT * FROM Przesylki WHERE (Przesylki.NazwiskoAdresata = @Nazwisko)
END

and action of the button:

SqlConnection con = new SqlConnection(Properties.Settings.Default.Monitoring_PrzesylekString1);
SqlCommand com = new SqlCommand("WyszukajPrzesylki", con);
com.CommandType = CommandType.StoredProcedure;
SqlParameter parametrNazwisko = new SqlParameter("@Nazwisko", SqlDbType.VarChar, 50);
parametrNazwisko.Value = "Dziubak";
com.Parameters.Add(parametrNazwisko);

SqlDataAdapter ad = new SqlDataAdapter(com.CommandText, con);
DataSet ds = new DataSet();

ad.Fill(ds, "id");
con.Close();
DataTable datatableA = ds.Tables[0];
dataGridView1.DataSource = ds;
dataGridView1.DataMember = "id";
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:29:00+00:00Added an answer on June 16, 2026 at 12:29 am

    You’re doing almost everything right – up to this line:

    SqlDataAdapter ad = new SqlDataAdapter(com.CommandText, con);
    

    You’re creating a SQL data adapter, but only based on the SQL statement of the com – you should use this instead:

    SqlDataAdapter ad = new SqlDataAdapter(com);
    

    You should use the whole com object you’ve already set up with parameters and everything – not just it’s SQL statement text!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I searched for my problem in Google and at this site but i still
I searched through internet and this site as well but haven't found the answer.
I've searched through the web and what I've found out is this: To make
I have searched through many times but have not seen this before. Probably really
I searched through here as best I could and though I found some relevant
although I searched through existing threads for my problem I havent found a solution
I've searched through the documentation and searched around but there is nothing said about
I've searched through the site and haven't found a question/answer that quite answer my
I dont know how to programmatically login to this site I've searched through stackoverflow
I searched this site and found an FTPWebRequest example via Powershell. I put it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.