Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
public List<ads> GetAllPromotedAdverts()
        {

            List<ads%gt; AllFundrasing = new List<ads>();
            using (SqlConnection dbconn = new SqlConnection(ConnectionString))
            {
                SqlCommand dbCommand = new SqlCommand("GetAllPromotionAdverts", dbconn);
                dbCommand.CommandType = CommandType.StoredProcedure;
                dbconn.Open();

                SqlDataReader dbReader = dbCommand.ExecuteReader();


                while (dbReader.Read())
                {
Posted
Updated 27-Aug-15 23:19pm
v2
Comments
hypermellow 28-Aug-15 5:13am    
That error sounds like it's coming from the stored procedure rather than the asp.net / c# layer.
What happens when you open a SQL window and run: exec GetAllPromotionAdverts

1 solution

I agree with hypermellow: check GetAllPromotionAdverts. This error is usually caused when you try to append text to an int like so:

SQL
select "id="+id from mytable

You have to cast the int to an nvarchar like so:
SQL
select "id="+cast(id as nvarchar(max)) from mytable


Hope that helps ^_^
Andy
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900