Hi all i seem to be having an issue with LINQ, i am currently maintaining an in house Intranet application at work,When Saving logs it seems to slow down now,upon debugging i have came to realise that everytime it saves a log the application pauses at these two section lines of codes.It does save the logs ,just that its slow and at times superslow.

DataClassesDataContext dab = new DataClassesDataContext();

dab.SubmitChanges();

My question primarily is ,are there any known issues with those two paticuler lines of code giving any sort of problem that can slow down an application? below is the full code used for inserting ,those who understand better could perhaps analyse it better and perhaps correct me where im wrong.Thanks in advance...

DataClassesDataContext dab = new DataClassesDataContext();

newlog = new calllog();
newlog.shortdesc = txtshortdesc.Text;
calllog_description.Text ="*****" + Page.User.Identity.Name + " " + DateTime.Now.ToString() + " ***** " + "\r\n" + calllog_description.Text;
newlog.calllog_description = calllog_description.Text;
newlog.calllog_id = Convert.ToInt32(txtlogid.Text);
newlog.calllogrefno = calllogrefno.Text;
newlog.pr_id = Convert.ToInt32(pr_id.SelectedItem.Value);
newlog.st_id = Convert.ToInt32(st_id.SelectedValue);
newlog.product_id = Convert.ToInt32(product_id.SelectedValue);
newlog.dep_id = Convert.ToInt32(dep_id.SelectedValue);
newlog.log_assigneduser = Convert.ToInt32(log_assigneduser.SelectedValue);
newlog.client_id = Convert.ToInt32(DropDownList1.SelectedValue);
newlog.log_datetime = System.DateTime.Now;
newlog.log_user_id = this.Page.User.Identity.Name;
newlog.calllog_internal = calllog_internal.Checked;
newlog.notify_client = true;
newlog.notify_practise = true;
newlog.ct_id = Convert.ToInt32(ct_id.SelectedValue);
newlog.resolved = false;
dab.calllogs.InsertOnSubmit(newlog);

dab.SubmitChanges();

Recommended Answers

All 2 Replies

loking at your code ..

everything seems okey

preety basic stuff..

but this part is bothering me lil bit..(calllog_description.Text;)

how big is your (calllog_description.Text) i mean wot's the dataType

------------------------------------------

try the same thing without using LINQ..

if still problem persist then it is not LINQ.

may be you are storing some huge data at a time

or something else..!

Hi!!! thanks for the reply,What i have done now is ive connected to a Stored Proc that inserts to the DB,using a DataSet,the Dataset seems to have no issues, in the sense that when i debug it,i do not get a pause in the same way LINQ does when a connection to the DB is opened.

I must point out though i am maintaninig this app,the previous Dev left,he did the actual LINQ mapping nd stuff, up till two or so weeks ago i had not worked with LINQ
at all...

Heres the descprition for the callog Field:''callog_description(varchar(max)null)''

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.