0

Hi guys I got a table called rc_Pages then I got a column called pName (Pages Name) and now I have made a new column called pCategory (Page Category). Since there are like 60 pages and updating the pages manually can be a big issue. I need to set the pCategory values depending on the pName.

So say a page starts with "C-Sharp" then the category is C#. etc.

I am using SQL Comptact. How can I do this? I try a couple of times to no luck. This is the code I got now but this won't work because it will change all pCategory to same value.

@{


var pCategory = "";
var msg = "";




if (IsPost){


 pCategory = Request ["pCategory"];

var SQLINSERT = "INSERT INTO rc_Pages  (pCategory) VALUES (@0) ";
var db = Database.Open("razorc");
db.Execute(SQLINSERT, pCategory);




}


 }














<form method="post">

 @msg

<input type="text" name="pCategory" id="pCategory"/>


 <input type="submit" value="Update"/>
2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by CriticalError
0

UPDATE rc_Pages SET pCategory = 'C#' WHERE pName LIKE 'C-Sharp%'

Thanks dude it has worked..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.