Click here to Skip to main content
15,896,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I wanna get pc.counter(Int) value and passing to search.counting(varchar)
after that value of pc.counter in database can be counter

here my database design of count

XML
CREATE TABLE [dbo].[parameterCount] (
    [Id]      INT NOT NULL,
    [counter] INT NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC)
);


and here it is what I tried but still not working.
C#
search.counting = pc.counter.ToString();
          pc.counter++;


if you can help me, I would appreciate it
Posted
Updated 12-Aug-15 22:30pm
v3
Comments
Wendelius 13-Aug-15 3:00am    
Please explain in more detail.
- Do you use Entity Framework to query the database?
- What is the definition of the variable "pc"?
- What is the definition of variable "search"
Member 11854019 13-Aug-15 3:05am    
i'm use entity framework
ParameterCount pc
and Search search
I have table Search which have counting row

1 solution

Please explain more what do you want exactly?? Like your counter should increase or it should update database etc...
 
Share this answer
 
Comments
Member 11854019 13-Aug-15 5:54am    
How to convert this query in controler MVC
UPDATE parameterCount SET counter = counter + 1 ;
if you can please tell me!
Member 11854019 13-Aug-15 5:59am    
exactly my problem is counter the database value after I use .
example : I have Table ParameterCounter which have { Id and CounterValue } Value {1,1}
I want to update Counter value after I use 1 then in data base i have Value {1,2}
in Mysql i have query "UPDATE parameterCount SET counterValue = counterValue + 1 ;" but how to transform that in controler of MVC?

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