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 8597715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:58:31+00:00 2026-06-12T00:58:31+00:00

I have a procedure in Sql that get @tpv as a parameter. when I

  • 0

I have a procedure in Sql that get @tpv as a parameter. when I exec the procedure from c# – It is not working, and when I exec the procedure from Sql – It’s working perfect. Why?

Edit: when I exec the proc from c# – it is not get an error, seem like it is work fine, but the table didn’t change at all and misRow=0 instead of misRow=1.

Procedure:

CREATE procedure [dbo].[UpdateAdsList]
@tvp ListCrc32 readonly
as
 update tb
 set a_update=CONVERT(date,GETDATE(),101)
 from Ads tb
 join @tvp t on t.crc32 = a_crc32

Exec from Sql:

declare @ ListCrc32

insert into @ (crc32)
select 1652908150

exec UpdateAdsList @

Exec from C#:

int mis=1652908150;

//create the dataTable
dt = new DataTable();
dt.Columns.Add("crc32", typeof(int));
var row = dt.NewRow();
row["crc32"] = mis;
dt.Rows.Add(row);

//exec the proc
con.Open();
var cmd = new SqlCommand("UpdateAdsList",con);
cmd.Parameters.Add("@tvp",SqlDbType.Structured);
cmd.Parameters["@tvp"].Value = dt;
cmd.Parameters["@tvp"].TypeName = "ListCrc32";
int misRow=cmd.ExecuteNonQuery();
con.close();
  • 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-12T00:58:32+00:00Added an answer on June 12, 2026 at 12:58 am

    You might try to add the parameter without the type:

    int mis=1652908150;
    
    //create the dataTable
    dt = new DataTable();
    dt.Columns.Add("crc32", typeof(int));
    var row = dt.NewRow();
    row["crc32"] = mis; // I do not see the point of convert.
    dt.Rows.Add(row);
    
    //exec the proc
    var cmd = new SqlCommand("UpdateAdsList",con);
    cmd.CommandType = Syste.Data.CommandType.StoredProcedure;
    
    cmd.Parameters.AddWithValue("@tvp",dt);
    
    con.Open();
    
    int misRow=cmd.ExecuteNonQuery();
    
    con.close();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SQL Server stored procedure that is not returning any data when
I have a stored procedure that retrieves sensitive information from an SQL Server 2008
I have a simple stored procedure in T-SQL that is instant when run from
I have a SQL procedure that generates a util file as its output depending
Let's say I have a stored procedure in Microsoft SQL Server 2005 that returns
I have an app that runs a stored procedure in SQL Server, checking the
I have a complex sql query that I have in a stored procedure and
I have a line in my SQL Stored Procedure that looks like this (works
I have an SQL CREATE PROCEDURE statement that runs perfectly in my local SQL
I have a stored procedure that has this line: SET @SQL = 'SELECT path,title,tags

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.