Updating An Entity (User) In Application?

Jun 21, 2011

I have a problem when updating an entity (User) in my application.

The entity is located in session when the user has been logged. So I made it:

Dim u as User = (From x in ctx.Users).First()
Session("user") = u


[code]...

I got the follow error:

An object with a key that matches the key of the supplied object could not be found in the ObjectState Manager.Verify that the key values of the supplied object match the key values of the object to which changes must be applied.

View 2 Replies


ADVERTISEMENT

Updating Child Collection Of POCO (adding/updating/deleting) In Entity Framework 4.1?

Jan 25, 2012

I have a webpage with a form that is used to edit some object. This object contains a Collection of other objects defined like this: Public Overridable Property Employees As List(Of Employee)

On a form I can delete an employee, add a new one or modify existing one. When I click save new values are sent to the server. On a server I check if the user exists. If exists then I modify its values, if it does not exist then I add it. All employees that exist on the server and were not sent are marked as deleted (State changed to EntityState.Deleted). I try to use the following code (dbCollection = database entities, newCollection = collection sent from the form):

[Code]...

This code does not work, because changing to EntityState.Deleted removes the object from collection, and for each loop breaks, since the collection is modified...I know that I can overcome this problem by using a for loop or adding objects to delete to some other list first, but I hope maybe there is a pattern that would make my code nicer.

View 1 Replies

Multi-user Application - Updating All Clients When A User Updates Data (push Vs Pull)?

Aug 26, 2009

I am designing a fairly small application to manage a waiting area for a clinical department. There will be a receptionist who books appointments and updates exisiting appointments to say that a patient has "Arrived". In seperate rooms will be nurses who call patients who have "Arrived" and update the appointment as "In Session" and finally as "Discharged". The appointments are viewed in a flexgrid with nurses across the top and time down the left, patient names are displayed at the relevant times and the cells are shaded a colour to represent the current appointment status ("Booked", "Arrived", "In Session" and "Discharged").

I am using SQL Server as the back-end and Visual Basic 6 (I know) as my front-end.I have been told that there will be 2 or 3 nurses plus the receptionist logged in to the system but I would like to cater for growth.My question is what is the best mechanism to use in order to reflect the status change made by one user on the screens of the other users currently logged in?

I have been thinking about using a timer to refresh the data at a set interval but I do not want to keep hitting the server excessively (although what is considered excessive? we would be talking about a call for data every 60 secs per user). Plus the server could be serving data for many other applications so this is another consideration.Alternatively I have been thinking about sending some kind of message via Winsock to the other users notifying them of data changes as they happen. I don't have a lot of experience with this and am concerned about clients not receiving messages and users seeing old data. It also seems strange to me that once the days appointments have been retrieved from the database that "in theory" a client could go the whole day without having to query the database again to pick up changes - kind of scary.Some information on the data:We would probably be looking at around 100 appointments per day We capture patient name, date of birth, date and time of appointment and appointment status.What is the standard approach / best practice for this kind of scenario?

View 6 Replies

VS 2008 User Updating Application Files?

Apr 26, 2011

way to update my application executable, and a few other application files for a simple application updater that I am using in my application. The code updates the files (including the executable, manifest, and a few other files), but on Windows Vista and Windows 7 machines you must run the application as Administrator in order for it to update the files in the application folder.

View 2 Replies

Entity Query Not Updating In For Each Correctly?

Apr 9, 2011

I have the following code:

' Now retabulate the current occupancy.
For Each row In assignments
Try

[code]....

View 1 Replies

DB Synchronisation Behavior - Can A User Read The Entry While Other User Is Updating That On Exact Same Time

Jul 25, 2011

I have a oracle database. I use the OracleDataAdapter(Oracle.DataAccess.dll) for select, update, insert, delete operations. I don't set any (table) locks on my own(I only start a transaction). I have a oracle table named "test" with the entry "test1".

Now my question: Can Person A read the entry "test1" while Person B is updating/deleting the entry at the exact same time? What happens in the worst case? An old match/empty match or can it cause any kind of exception/error(e.g. "TableLocked-Exception")?

View 1 Replies

Asp.net - Linq Group By An Entity And Then Order By The Grouped (nullable) Entity

Jul 27, 2011

I am trying to build a survey engine from an existing database design which is like this.

[Code]...

The line Order By Key.RecordOrder throws a null reference exception and I can understand why. Can someone advise on how to resolve this by just modifying this one query? I am fairly new to LINQ and the necessity to write this project

[Code]...

View 1 Replies

.net - Global Entity Framework Context In WPF Application?

May 20, 2010

I am in the middle of development of a WPF application that is using Entity Framework (.NET 3.5). It accesses the entities in several places throughout. I am worried about consistency throughout the application in regard to the entities. Should I be instancing separate contexts in my different views, or should I (and is a a good way to do this) instance a single context that can be accessed globally?

For instance, my entity model has three sections, Shipments (with child packages and further child contents), Companies/Contacts (with child addresses and telephones), and disk specs. The Shipments and EditShipment views access the DiskSpecs, and the OptionsView manages the DiskSpecs (Create, Edit, Delete). If I edit a DiskSpec, I have to have something in the ShipmentsView to retrieve the latest specs if I have separate contexts right?

If it is safe to have one overall context from which the rest of the app retrieves it's objects, then I imagine that is the way to go. If so, where would that instance be put? I am using VB.NET, but I can translate from C# pretty good. I just don't want one of those applications where the user has to hit reload a dozen times in different parts of the app to get the new data.

All contexts are created in Using Blocks to dispose of them after they are no longer needed.When loaded, all entities are detatched from context before it is disposed.A new property in the MainViewModel (ContextUpdated) raises an event that all of the other ViewModels subscribe to which runs that ViewModels RefreshEntities method.After implementing this, I started getting errors saying that an entity can only be referenced by one ChangeTracker at a time. Since I could not figure out which context was still referencing the entity (shouldn't be any context right?) I cast the object as IEntityWithChangeTracker, and set SetChangeTracker to nothing (Null).

This has let to the current problem:When I Null the changeTracker on the Entity, and then attach it to a context, it loses it's changed state and does not get updated to the database. However if I do not null the change tracker, I can't attach. I have my own change tracking code, so that is not a problem.

My new question is, how are you supposed to do this. A good example Entity query and entity save code snipped would go a long way, cause I am beating my head in trying to get what I once thought was a simple transaction to work.

View 2 Replies

.net - ADO.net Entity Framework - Update Only Certain Properties On A Detached Entity

Jul 22, 2009

I want to update an entity without loading the entity from the database first. I've accomplished this but only by knowing all of the entities properties and then using the "attachto" method. My issues is i don't want my app to need to remember all of the properties. Example:

[Code]....

View 3 Replies

.NET Sample Entity Framework 4.2 Code First Entity Splitting?

Dec 14, 2011

Entity Splitting: one class, two or more tables.Here is how it is done in C#, but I need to get it working in vb.net.One more thing: the class name and table columns do not match, so I have to be able to map that out, too.I have to get this to work this way because the place I'm working at right now is a vb.net only shop and the database schema is fubar, but they have so much (millions) of lines of code done directly against the database in both asp classic, vb.net, AND asp.net webforms that changing the schema right now is not realistically possible.

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Post>()
.Map(m =>

[code]....

View 1 Replies

Excessive SQL Server Processes For Entity Framework Based Application

Jun 27, 2011

We are currently developing a WPF/Entity-Framework based application.One of our requirements was to allow the user option to select which environment(testing, training, or production) they will connect to when logging in.Each connection option points to its own database.In order to do this we are creating new EF contexts in the following way:[code]We have made sure that all new contexts are being disposed of once its job is completed.The problem is this: when the users are using the application we are seeing hundreds of SQL Server processes in SQL Server's activity monitor. Some individual users have upwards of 30+ processes associated when using the app. Once the user shuts down the app the associated processes all disappear - but while the app is running these processes seem to stick around.

View 1 Replies

Asp.net - Using ExecuteQuery() With Entity Framework, Entity Class

Jan 16, 2011

I am trying to jump from ASP Classic to asp.net. I have followed tutorials to get Entity Framework and LINQ to connect to my test database, but I am having difficulties figuring out ExecuteQuery(). I believe the problem is that I need an "entity class" for my database, but I can't figure out how to do it. Here is my simple code:

Dim db as New TestModel.TestEntity
Dim results AS IEnumerable(OF ???) = db.ExecuteQuery(Of ???)("Select * from Table1")

From the microsoft example site, they use an entity class called Customers, but I don't understand what that means.

View 1 Replies

C# - Inherited Entity Item Not Recognized As Entity?

Feb 11, 2011

I am trying to create a generic typed class, but am running into a problem. Here is my basic class definition:

public class QueueObject<T> where T : System.ServiceModel.DomainServices.Client.Entity
{
public string LoadingMessage { get; set; }
public System.ServiceModel.DomainServices.Client.EntityQuery<T> Query { get; set; }
}

I am trying to add instances of this class to a queue

private Queue<QueueObject<Entity>> _queue;
this._queue.Enqueue(new QueueObject<MyEntity> {Query = MyContext.GetMyEntitiesQuery(), LoadingMessage = "Loading some stuff"});

This doesn't work. I get an error saying that QueueObject cannont be converted to QueueObject. I don't understand because MyEntity inherits from Entity.

Public Class QueueObject(Of T As System.ServiceModel.DomainServices.Client.Entity)
Public Property LoadingMessage As String
Public Property Query As System.ServiceModel.DomainServices.Client.EntityQuery(Of T)
End Class

[code]....

View 2 Replies

User Input Not Updating In New Dgv Row

Nov 4, 2009

I have followed a tutorial at url.... It is a very good tutorial but it is also a little dated. Most people who visit it praise it to high heaven so I decided it was a good place to start as an absolute beginner to programming. (I have teamed it up with Dan Mabbut Vis basic tutorial at about.com and joined DreamInCode in order to learn what I can accomplish with Visual Basic 2008 Express ). I am up to part 6 of 7 but keep going back to part 4 because there is one aspect I just cant work out.I am creating a form which logs staff in or out of work and allows staff to include a message with their ( at work /away from work ) status details on the form.The form is supposed to update a users status in a new row when they click a button. In my form the rows per user are being over-written with the updated information - it is not being written in a new row. There is a login form which precedes the staff status form - this has a little relevant code re calling the user info from the database but I think my problem is related to the insert statement in the middle of the below code.[code]

My code has changed quite a bit since the above as the form has progressed but the problem started at the stage above and has not changed with the forms progression. Every other aspect of staff update info is working well in my form - just not in a new row.I am going bald - The tutorial was written for VB2005 Express - I am using VB2008 Express though it has not made too much difference to the tutorial.

View 3 Replies

DB/Reporting :: Updating Output For End User From Database?

May 2, 2008

Alright, let's try this again. I have an mdb file as a database in my program, I need this mdb file to be what my published program reads off of. Is there any way to have Visual Basic (2008 Express) not encode my mdb file to Example.mdb.deploy?

View 1 Replies

How To Create Form For Updating User Password

Jun 15, 2012

I am trying to make a form for an app that will update the current users password to something new of his choice but I cant seem to make it update the database and just says the wrong password statement.

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim connection As New SqlClient.SqlConnection
Dim command As New SqlClient.SqlCommand
Dim adaptor As New SqlClient.SqlDataAdapter
Dim dataset As New DataSet
[Code] .....

View 7 Replies

Updating The Non-VSHost Exe's User.config File?

Apr 25, 2012

I have a program that runs fine in the debugger. I started on the project in x86 mode this January and I've always been able to run it outside of the debugger, but this is the first time I've seen this error.The error says "ConfigurationErrorException was unhandled: Configuration system failed to initialize."The InnerException of the error said that the error was in the user.config file, and it gave me the directory of the user.config file that it was using. So I clicked synchronize in the project settings thinking that it would overwrite the current user.config file and that would probably fix the error. When it showed the confirmation dialog that it would delete the user.config file, I noticed that it had "vshost" in the directory.

View 1 Replies

VS 2010 Restrict User Updating A Combo Box?

Oct 11, 2011

When the user open the form a textbox is displayed that picks up data from a table. If they click Change button a combo box is displayed that allows them to change what was originally in the textbox. The combobox is updated with whatever was in the textbox as shown below.This all works fine but the user can add something in the combo box that is not in the list which is bad.

cmbAddBook.Visible = True
cmbAddBook.Text = txtAddBook.Text
txtAddBook.Visible = False

[code]....

View 1 Replies

Program Not Updating Screen - No Response To User Input

Jan 2, 2012

I have a program written in VB 2010 express under windows xp which does some heavy number crunching combined with serial communication. When it "gets too busy" it does not update the screen anymore (done simply with Textbox.text = "any text") and it does not respond to user input in any text box. Not even to a click on any text box. Is there a way I can get the program to do screen update and respond to user input while it is busy?

View 3 Replies

VS 2008 - Updating EXE And Manifest Clears User Settings

Jan 3, 2011

I've got a VB .NET application that has an auto-updater that updates the exe and manifest files of the application when it finds a new version. For some reason when I update those 2 files, it also clears the user settings, even though Im not replacing the exe.config file.

View 5 Replies

Stop Updating The User Display Of A Control (rich Text Box) Temporarily?

Nov 15, 2011

Can I stop updating the user display of a control (rich text box) temporarily? I want it to process what I tell but not change how it looks for just a small piece of code.

View 5 Replies

Updating A Data User 2008 And Sql Server Management Studio Express

Apr 19, 2011

I'm trying to update a data user using vb.net2008 and sql server management studio express for my backend. the error says "must declare the scalar variable "@username"

Here's the code .

Private Sub btnupdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles btnupdate.Click
Dim connstring = New SqlClient.SqlConnection("Data Source=MISD-

[CODE]...

View 1 Replies

Asp.net - Application For Updating Database?

May 4, 2011

i have published my website...its a dynamic site..so i have database connectivity..now i want to make an application in VB to update my database using my application..i mean i do not want to login to the site and update my database rather update it using my application..i want to connect my application to the database of the published site and update it from anywhere i want using the application...is it possible??

How can i do it??Please point me to the right direction...its urgent.

View 3 Replies

.net - Updating A Webpage From A Desktop Application?

Aug 20, 2011

've written a desktop application in VB.net which gets data from numerous serial devices and graphs it in a windows form. What I'd like to do enable remote users to view this data remotely from a web browser.

So, is it possible to add a webpage to a desktop application which could be dynamically updated from from my windows app or do I have to rewrite the entire application in asp, flex or silverlight so it can be viewed remotely via a web browser?I'm not familiar with asp flex or silverlight and have only developed desktop apps using vb.net 2010 on win7 and XP.

View 5 Replies

Application Form Stops Updating Once Alt-tab Away?

Oct 23, 2009

I have a windows Forms app that displays data as it scans.Once you alt-tab or remove "focus" from the app and doing something else (open word) it stops updating. In otherwords it looks like the app has locked up.But it will finish the scanning as normal.But any updates from the scans being shown on the app window are not shown, that is until the app is finished and catches up.

[Code]...

View 8 Replies

Auto-Updating VB 2008 Application

Jun 12, 2010

i was playing around with the visual basic 2008's project settings. I have 2 goals in mind

[Code]....

View 3 Replies

Creating An Auto-Updating Application?

Jan 4, 2006

I have read through the following page: [URL]

Now I have my application and an installer project, which can install my application. how to make my application auto-update (from my web server) like a smart client. I've looked into ClickOnce, but it does not appear to be suitable as I cannot do any custom installation steps. My application needs to create folders and copy other files from the CD to the hard drive, which I don't believe ClickOnce supports. On the other hand, the Windows Installer does not natively support any sort of auto-updating. So what do I do?

I have read that it is possible to combine both technologies, but all my research into this has turned up nothing of use.

I've looked into the Updater Application Block (Version 2.0), but I'm not sure if this is what I'm looking for? I'm using Visual Basic 2005 and I'm not sure if the Updater Application Block supports .NET v2.0. In fact, when I tried to install the Enterprise Library, it said I need .NET v1.1??? Even if this is a possible path, I'm really quite lost when reading through the documentation as nothing seems to point towards practical examples, especially in Visual Basic.

I've also had a look at the System.Deployment.ApplicationDeployment class, but it seems as though this only works with ClickOnce applications. However, since I can't seems to use ClickOnce in my situation, this does not seem like a viable option. Is it possible to use System.Deployment.ApplicationDeployment outside of a ClickOnce application?

I'm really quite lost as to how other people produce custom installing applications that have auto-updating features. Virtually every modern piece of software does it, but I cannot seem to find anything on the web that points me in the right direction of how to achieve this with Visual Basic 2005.

View 11 Replies

IDE :: Auto Updating Application DLLs In Web

Sep 26, 2009

I'm looking for a way for copying a VS application files via HTTP and TCP? I mean I have published my application and now I am trying to find something like ClickOnce application that copies my updated files from my website to the clients' centers through HTTP and then locally to end users through FTP. I need to a source code or something like that.

View 2 Replies

Not Updating Framework But Still Allowing Application To Run?

Jun 15, 2010

For school i have made an application in VB (Express 2010, .net v4) and when i try to run it at school it says that the .net framework needs to be updated.

IS there anyway of not updating the framework but still allowing the application to run?

View 4 Replies

Updating A Webpage From A Desktop Application?

Aug 10, 2010

I need to calculate in hours how much time has elapsed from when a record was created to the current time. The hard part is I need to exclude weekend times from this. I have been working on this for quite a while and I am just lost. Here is what I have so far.

[code]...

What algorithm in VB.NET would best suit this calculation?

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved