Linq problem

  • Thread starter Thread starter David
  • Start date Start date
D

David

Hi,

I am using Linq to Sql.

I have a linkbutton in an AJAX update panel.

The link button on click has...

using (DataClassesDataContext dc = new DataClassesDataContext())
{

ServiceSheet sheet = dc.ServiceSheets.First(a => a.SheetID ==
Request.QueryString["sheet"]);
sheet.TrailerID = TempTrailerIDLinkButton.Text;
dc.SubmitChanges();

}
BarcodeHandlerPanel.Visible = false;

Now, when I step through it, it appears the sheet.TrailerID is set, as if I
look at sheet after assigning the TrailerID, I can see the new ID. I then
see the BarcodeHandlerPanel disappear... so I know it is not crashing out...
however, when I look at my data, absolutely nothing has happened.

Any ideas?

All help would be appreciated. I really don't understand this, unless it is
because my machine is low on resources... but having checked a similar
update (different data and different table) elsewhere (not inside an ajax
panel), the update works.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
 
Hi David,

Did you try profiling the SQL database to see if you query goes there at
all?
 
Hi,

I am using Sql Express on my dev machine and express doesn't appear to come
with profiler.

How can I tell?

I know that the query picks up from Sql as a select, as if I hover over
"sheet", then expand, I can see all the fields and values relative to the
sheet id.

I have just rebooted my dev machine in case it was a resource issue, but it
doesn't appear to be.

I will try removing and re-adding sheetdetails to the dataclassesdatacontext
to see if that helps.

I have spent ages on this one tiny problem. I am still new to Linq and it is
taking me ages where if I did it in SQL, it would only take me a few seconds
to do this.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available


Coskun Sunali said:
Hi David,

Did you try profiling the SQL database to see if you query goes there at
all?

--
Coskun Sunali
Microsoft MVP - ASP.NET
http://sunali.com
http://propeople.dk

David said:
Hi,

I am using Linq to Sql.

I have a linkbutton in an AJAX update panel.

The link button on click has...

using (DataClassesDataContext dc = new DataClassesDataContext())
{

ServiceSheet sheet = dc.ServiceSheets.First(a => a.SheetID ==
Request.QueryString["sheet"]);
sheet.TrailerID = TempTrailerIDLinkButton.Text;
dc.SubmitChanges();

}
BarcodeHandlerPanel.Visible = false;

Now, when I step through it, it appears the sheet.TrailerID is set, as if
I look at sheet after assigning the TrailerID, I can see the new ID. I
then see the BarcodeHandlerPanel disappear... so I know it is not
crashing out... however, when I look at my data, absolutely nothing has
happened.

Any ideas?

All help would be appreciated. I really don't understand this, unless it
is because my machine is low on resources... but having checked a similar
update (different data and different table) elsewhere (not inside an ajax
panel), the update works.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
 
Further to my last...

I have downloaded a profiler from
http://code.google.com/p/sqlexpressprofiler/downloads/list

I can see the select, but I can't see the update.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available


Coskun Sunali said:
Hi David,

Did you try profiling the SQL database to see if you query goes there at
all?

--
Coskun Sunali
Microsoft MVP - ASP.NET
http://sunali.com
http://propeople.dk

David said:
Hi,

I am using Linq to Sql.

I have a linkbutton in an AJAX update panel.

The link button on click has...

using (DataClassesDataContext dc = new DataClassesDataContext())
{

ServiceSheet sheet = dc.ServiceSheets.First(a => a.SheetID ==
Request.QueryString["sheet"]);
sheet.TrailerID = TempTrailerIDLinkButton.Text;
dc.SubmitChanges();

}
BarcodeHandlerPanel.Visible = false;

Now, when I step through it, it appears the sheet.TrailerID is set, as if
I look at sheet after assigning the TrailerID, I can see the new ID. I
then see the BarcodeHandlerPanel disappear... so I know it is not
crashing out... however, when I look at my data, absolutely nothing has
happened.

Any ideas?

All help would be appreciated. I really don't understand this, unless it
is because my machine is low on resources... but having checked a similar
update (different data and different table) elsewhere (not inside an ajax
panel), the update works.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
 
Hi,

I tried removing and re-adding the table in the dbml. No change.

I copied the code to another non-ajax page... No change.

I rebooted my notebook. No change.

Have I done something wrong in the code, or is Linq a bit flakey?

It appears that the query selects the data (which I can see anyway), I can
see the change when I assign to sheet.TrailerID but the update just doesn't
happen. The profiler is not seeing an update statement.

Is there something I need to do in the DBML? Anything I can check? It is
frustrating... and at the moment, I have reverted back to plain SQL and it
took me less than 30 seconds to write, whereas I have spent too much time
trying to get the Linq query to work.

If you need any more information, please ask.
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available


David said:
Further to my last...

I have downloaded a profiler from
http://code.google.com/p/sqlexpressprofiler/downloads/list

I can see the select, but I can't see the update.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available


Coskun Sunali said:
Hi David,

Did you try profiling the SQL database to see if you query goes there at
all?

--
Coskun Sunali
Microsoft MVP - ASP.NET
http://sunali.com
http://propeople.dk

David said:
Hi,

I am using Linq to Sql.

I have a linkbutton in an AJAX update panel.

The link button on click has...

using (DataClassesDataContext dc = new DataClassesDataContext())
{

ServiceSheet sheet = dc.ServiceSheets.First(a => a.SheetID ==
Request.QueryString["sheet"]);
sheet.TrailerID = TempTrailerIDLinkButton.Text;
dc.SubmitChanges();

}
BarcodeHandlerPanel.Visible = false;

Now, when I step through it, it appears the sheet.TrailerID is set, as
if I look at sheet after assigning the TrailerID, I can see the new ID.
I then see the BarcodeHandlerPanel disappear... so I know it is not
crashing out... however, when I look at my data, absolutely nothing has
happened.

Any ideas?

All help would be appreciated. I really don't understand this, unless it
is because my machine is low on resources... but having checked a
similar update (different data and different table) elsewhere (not
inside an ajax panel), the update works.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
 
Hi David,

Just out of curiosity, would you please try adding a primary key (for
instance, type of integer) to the table and update your DBML and then try
updating the row again. Your code looks pretty correct. The problem must be
in DBML if you say that profiler cannot see an update query being executed.

Please let me know with the result.

--
Coskun Sunali
Microsoft MVP - ASP.NET
http://sunali.com
http://propeople.dk

David said:
Hi,

I tried removing and re-adding the table in the dbml. No change.

I copied the code to another non-ajax page... No change.

I rebooted my notebook. No change.

Have I done something wrong in the code, or is Linq a bit flakey?

It appears that the query selects the data (which I can see anyway), I can
see the change when I assign to sheet.TrailerID but the update just
doesn't happen. The profiler is not seeing an update statement.

Is there something I need to do in the DBML? Anything I can check? It is
frustrating... and at the moment, I have reverted back to plain SQL and it
took me less than 30 seconds to write, whereas I have spent too much time
trying to get the Linq query to work.

If you need any more information, please ask.
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available


David said:
Further to my last...

I have downloaded a profiler from
http://code.google.com/p/sqlexpressprofiler/downloads/list

I can see the select, but I can't see the update.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available


Coskun Sunali said:
Hi David,

Did you try profiling the SQL database to see if you query goes there at
all?

--
Coskun Sunali
Microsoft MVP - ASP.NET
http://sunali.com
http://propeople.dk

Hi,

I am using Linq to Sql.

I have a linkbutton in an AJAX update panel.

The link button on click has...

using (DataClassesDataContext dc = new DataClassesDataContext())
{

ServiceSheet sheet = dc.ServiceSheets.First(a => a.SheetID
== Request.QueryString["sheet"]);
sheet.TrailerID = TempTrailerIDLinkButton.Text;
dc.SubmitChanges();

}
BarcodeHandlerPanel.Visible = false;

Now, when I step through it, it appears the sheet.TrailerID is set, as
if I look at sheet after assigning the TrailerID, I can see the new ID.
I then see the BarcodeHandlerPanel disappear... so I know it is not
crashing out... however, when I look at my data, absolutely nothing has
happened.

Any ideas?

All help would be appreciated. I really don't understand this, unless
it is because my machine is low on resources... but having checked a
similar update (different data and different table) elsewhere (not
inside an ajax panel), the update works.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
 
Well, I never...

Thanks, that was it. I will remember that. I didn't know that the primary
key would have caused the problem.

I usually add the PK, but in this instance I forgot and never noticed it
wasn't there. There was another table with the PK missing as well.

I noted that when I deleted the table from the DBML, then re-added it, the
PK still wasn't showing, even though if I double clicked the table in server
explorer, it showed it. Even adding the PK in the properties of the table
(by clicking the ID field in the DBML and changing the ID property) didn't
work.

I had to delete the table from the DBML, close all the DBML files, re-open,
re-add the table, set the relationships and then it worked.

Thanks for your help.
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available


Coskun Sunali said:
Hi David,

Just out of curiosity, would you please try adding a primary key (for
instance, type of integer) to the table and update your DBML and then try
updating the row again. Your code looks pretty correct. The problem must
be in DBML if you say that profiler cannot see an update query being
executed.

Please let me know with the result.

--
Coskun Sunali
Microsoft MVP - ASP.NET
http://sunali.com
http://propeople.dk

David said:
Hi,

I tried removing and re-adding the table in the dbml. No change.

I copied the code to another non-ajax page... No change.

I rebooted my notebook. No change.

Have I done something wrong in the code, or is Linq a bit flakey?

It appears that the query selects the data (which I can see anyway), I
can see the change when I assign to sheet.TrailerID but the update just
doesn't happen. The profiler is not seeing an update statement.

Is there something I need to do in the DBML? Anything I can check? It is
frustrating... and at the moment, I have reverted back to plain SQL and
it took me less than 30 seconds to write, whereas I have spent too much
time trying to get the Linq query to work.

If you need any more information, please ask.
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available


David said:
Further to my last...

I have downloaded a profiler from
http://code.google.com/p/sqlexpressprofiler/downloads/list

I can see the select, but I can't see the update.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available


Hi David,

Did you try profiling the SQL database to see if you query goes there
at all?

--
Coskun Sunali
Microsoft MVP - ASP.NET
http://sunali.com
http://propeople.dk

Hi,

I am using Linq to Sql.

I have a linkbutton in an AJAX update panel.

The link button on click has...

using (DataClassesDataContext dc = new
DataClassesDataContext())
{

ServiceSheet sheet = dc.ServiceSheets.First(a => a.SheetID
== Request.QueryString["sheet"]);
sheet.TrailerID = TempTrailerIDLinkButton.Text;
dc.SubmitChanges();

}
BarcodeHandlerPanel.Visible = false;

Now, when I step through it, it appears the sheet.TrailerID is set, as
if I look at sheet after assigning the TrailerID, I can see the new
ID. I then see the BarcodeHandlerPanel disappear... so I know it is
not crashing out... however, when I look at my data, absolutely
nothing has happened.

Any ideas?

All help would be appreciated. I really don't understand this, unless
it is because my machine is low on resources... but having checked a
similar update (different data and different table) elsewhere (not
inside an ajax panel), the update works.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
 
Hi David,

Glad to hear that it worked with the PK.

--
Coskun Sunali
Microsoft MVP - ASP.NET
http://sunali.com
http://propeople.dk

David said:
Well, I never...

Thanks, that was it. I will remember that. I didn't know that the primary
key would have caused the problem.

I usually add the PK, but in this instance I forgot and never noticed it
wasn't there. There was another table with the PK missing as well.

I noted that when I deleted the table from the DBML, then re-added it, the
PK still wasn't showing, even though if I double clicked the table in
server explorer, it showed it. Even adding the PK in the properties of the
table (by clicking the ID field in the DBML and changing the ID property)
didn't work.

I had to delete the table from the DBML, close all the DBML files,
re-open, re-add the table, set the relationships and then it worked.

Thanks for your help.
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available


Coskun Sunali said:
Hi David,

Just out of curiosity, would you please try adding a primary key (for
instance, type of integer) to the table and update your DBML and then try
updating the row again. Your code looks pretty correct. The problem must
be in DBML if you say that profiler cannot see an update query being
executed.

Please let me know with the result.

--
Coskun Sunali
Microsoft MVP - ASP.NET
http://sunali.com
http://propeople.dk

David said:
Hi,

I tried removing and re-adding the table in the dbml. No change.

I copied the code to another non-ajax page... No change.

I rebooted my notebook. No change.

Have I done something wrong in the code, or is Linq a bit flakey?

It appears that the query selects the data (which I can see anyway), I
can see the change when I assign to sheet.TrailerID but the update just
doesn't happen. The profiler is not seeing an update statement.

Is there something I need to do in the DBML? Anything I can check? It is
frustrating... and at the moment, I have reverted back to plain SQL and
it took me less than 30 seconds to write, whereas I have spent too much
time trying to get the Linq query to work.

If you need any more information, please ask.
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available


Further to my last...

I have downloaded a profiler from
http://code.google.com/p/sqlexpressprofiler/downloads/list

I can see the select, but I can't see the update.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available


Hi David,

Did you try profiling the SQL database to see if you query goes there
at all?

--
Coskun Sunali
Microsoft MVP - ASP.NET
http://sunali.com
http://propeople.dk

Hi,

I am using Linq to Sql.

I have a linkbutton in an AJAX update panel.

The link button on click has...

using (DataClassesDataContext dc = new
DataClassesDataContext())
{

ServiceSheet sheet = dc.ServiceSheets.First(a => a.SheetID
== Request.QueryString["sheet"]);
sheet.TrailerID = TempTrailerIDLinkButton.Text;
dc.SubmitChanges();

}
BarcodeHandlerPanel.Visible = false;

Now, when I step through it, it appears the sheet.TrailerID is set,
as if I look at sheet after assigning the TrailerID, I can see the
new ID. I then see the BarcodeHandlerPanel disappear... so I know it
is not crashing out... however, when I look at my data, absolutely
nothing has happened.

Any ideas?

All help would be appreciated. I really don't understand this, unless
it is because my machine is low on resources... but having checked a
similar update (different data and different table) elsewhere (not
inside an ajax panel), the update works.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
 
Back
Top