LINQ to SQL (update table)

S

soworl

Hi I'm in the trouble.
I cannot update my sql table.

1. I use the O/R designer.
2. Select query is ok. I can see the data. : step1
3. I can see the change on memory : step2
4. but The change is gone at step3 and also no change to actual database.

No error on build.

How I can solve this...
did I miss something?
Please advise me.

Thanks in advance
soworl

static void Main(string[] args)
{
Validation objValidate = new Validation();
ClassifiedsDataContext ocr = new ClassifiedsDataContext();

var query = (from clas in ocr.Import_Classifieds where clas.ADID
== "0008607648-01" select clas);
foreach (var q in query)
{
//step 1 : I can see the data
Console.WriteLine("id = {0}", q.IMAGE_HTTP);
string phone = objValidate.ParsePhoneNumber(q.TEXT);
Console.WriteLine(phone);
q.IMAGE_HTTP = phone;
//step 2 : I can see the change from memory(?)
Console.WriteLine("id = {0}", q.IMAGE_HTTP);
}
ocr.SubmitChanges();
Console.ReadLine();
foreach (var q in query)
{
// step 3 : The Change is gone. the data is original data.
Console.WriteLine("id = {0}", q.IMAGE_HTTP);

}
Console.ReadLine();
 
S

soworl

of course,
see the my previous code.
you can find ocr.SubmitChanges();

Thanks,
soworl
 
M

Marc Gravell

you can find ocr.SubmitChanges();

Apols - I missed it; you are right - it is there ;-p

Any chance you could post the IMAGE_HTTP declaration incuding
attributes? I'm wondering if it things it is calculated, or not a
registered db field, or something...

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top