vb.net - How to work with multiple updates by linq to sql? -


First of all, I would like to ask if it is possible to edit many records by the linqtosql method in a click event? What I am trying to do is edit all the names in the table, I had the same account number I was able to edit, but only one name has been edited and there are no rest, if possible I really appreciate it if you take your time with me to resolve this issue. Give me the code you use. / P>

  Private sub button 2_Click (------------) button handle 2. Click the slow accnt string accnt = Textbox1.Text dim db as new memrecDataContext () dim editrecord = From Mem in db.Table1s _ where mem.Account = accnt _ editrecord mem memes in each mem.Name = Textbox2.Text db.SubmitChanges () Next MsgBox ("Successfully Completed", MsgBoxStyle.Information) End Sub  

Why is it that only one of these codes can be used to edit the records in Dato? Can you debug the code to edit all records, which are being queried when there is a single account number? If this is possible for you.

You are calling submit changelog in a loop. You do not have to do this - just make all the desired edits and then call SubmitChanges . It should have worked in the loop, I believe, but it is less efficient. Here's your code with some of the following leaks:

  Private sub button 2_Click (------------) button handle 2. Click the slow accnt string as the = Textbox1.Text using the new memrecDataContext () as DB slow editrecord = MB to db.Table1s _ where mem.Account = accnt _ editrecord for each mem mem.Name = Textbox2. Text next db.SubmitChanges () Finally using MsgBox ("successfully completed", MsgBoxStyle.Information) End Sub  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -