Entities And Multiple Databases?

Sep 26, 2010

We've got the following scenario:

Central Database (replicated across multiple servers)
Client Database 1
Client Database 2

The Central db has Users and Roles amongst other things The Client dbs have similar tables to each other but with some fields tweaked - contact, address, At present, each client db has its own user/role information which is copied from the central db by a scheduled process. I want to retrieve the user/role information directly from the central db instead (bearing in mind tables in the client db make reference to the user entity)

View 1 Replies


ADVERTISEMENT

.net - Querying Values In Multiple Databases?

Oct 16, 2010

I'm using this function to return a value from multiple databases across three SQL instances (On the same server). I'm looping though a DataGridView that lists all the databases on one of the three SQL instances.Is there a faster way of doing this? It's quite slow using this method.

Function DatabaseStatus(ByVal SQLServer As String, ByVal Database As String)
Dim myConn As New SqlConnection("Server=" & SQLServer & ";User Id=USER;Password=PASSWORD;Database=" & Database & ";")
Dim Status As String = ""

[code]....

View 2 Replies

Best Way To Set Up Server That Could Hold Multiple Databases

Apr 5, 2010

connect my vb.net application to a remote sql server database, so every one who installs the application would be able to connect to the same remote database. the application would obviously require the internet to run.i also want the option to add more databases in the future, preferably one for each business who would use my software.i am wondering the best way to set up this server that could hold multiple databases. i would think i have two options:

1) set up the server myself on a dedicated computer

2) pay for some type of service that host sql server dataases

so how would i go about executing these options? i dont know the first thing. which option is better?i do however know how to connect to a remote database so thats not what i am asking.

View 5 Replies

Multiple Databases Information Display?

Jul 7, 2011

I currently have an old database that has tables for requests and customers. This information is currently displayed in ASP.NET

What I was required to do, was to connect a new database for users into this system, while keeping the tables for the requests in the old database. Thus it is using 2 databases. I have set it up so, when a user creates a new request, in the request tables it saves it with his userID from the new database, but when the table is being displayed, it uses this new userID to find the user information from the old customers table. Thus I ended up with this:

Sub BindDataGrid()
cmdoledb = New SqlCommand("SELECT r.customerid, r.RequestID, R.RequestDate, R.RequestDescription, a.AssignedTo, r.Urgency, r.ExCompletionDate from tbl_requests r, tbl_assignedto a where r.statusid = 1 and r.assignedtoid=

[Code]....

Currently it displays nothing, and gives out an error for myItem.Value = rdr.GetInt32(0) being a Null. I went through it step by step and it loads customerids normaly into the myItem.Value, but when they run out, it is supposed to exit, but keeps going, thus giving an error.

View 1 Replies

.net - Nested Queries From Multiple Oracle Databases

Jul 21, 2011

In .NET, Is it possible to run a nested query from two separate Oracle databases?

[Code]...

Ultimately, this is an effort to overcome an "ORA-01795" error from using an "in" statement with over 1000 items in the conditional list, without having to break the query out into multiple "OR value IN" lists.

View 3 Replies

Addding Multiple Databases (datasets) Into One VB Project

Jun 28, 2011

I have a dilemma. The program I"m trying to complete is one VB project with three (3) forms. The first form will act as a menu dialog box. The other two forms will have a dataset (database) on each form. The first form will have a button when clicked it will pull up form 2 and the second button when clicked will bring up form 3. What I add the dataset to form 2 everything is fine. I can see my tableadapter, dataset and so on. Now, when I add the second dataset (database) to form 3, I loose my, dataset and so on. It doesn't appear on any of the two forms (in designer)tableadapter.

View 1 Replies

Finding A Record Across Multiple Access Databases?

May 3, 2010

At my company, product is boxed and then placed on a scale/label printer set up in order to be weighed and labeled. The application running on the PC also records a record of each box in an MS Access Database which is then transferred to the main server. There is a separate access database for each scale PC and currently the only way our shipping department can print out a manifest for each pallet (which contains a list of all the boxes and their weights) is to open the correct access database and print out the report by entering the pallet number. Since there are six printer scales and the shipping person has no idea which scale it will be on just by looking at the number, she has to find the correct database through trial-and-error.

What I've been asked to do is create an application where she can simply type in the pallet number, and it will search each individual database for the number, then open the correct one where she can then print out the report without having to guess where it is. I've already figured out how to make the application open the database and report, but I don't know how to make it find which database the pallet record is contained in.Basically I want it to search a number of databases for a particular number in a field, and the return a value when it finds it of which database it is so that I can plug that in later. I have no idea how to do this and my searches online have proven fruitless.

View 3 Replies

Asp.net - Utilize Multiple Databases In An Entity Framework Solution Simultaneously?

May 31, 2011

I have two unrelated databases and I need to pass data back and forth between them. Right now I have created two separate entity models - one for each database - but this is causing issues in my code b/c I have to do a Using nameofcontext / End Using and when I try to then use some of the results from the first section of the code in a second Using nameofcontext / End Using it doesn't like it - b/c I've closed the connection to the first database!

View 1 Replies

Create A Program That Will Allow Multiple Office To Run The Same Software And Update Their Local Databases?

Jun 1, 2009

ive been asked to write a program to deal with supply chains (tracking commodities, personnel, etc). I want to create a program that will allow multiple office to run the same software and update their local databases as well as a central database.how to best send the data/ recieve it, and store it so that all offices can see, edit, and store the data both locally, and over the internet.

View 13 Replies

Stepping Through All IE Entities?

Dec 21, 2011

I am quite new to VB and have a Problem. I need to step through all IE entities and extract the html source of a tab where some conditions are met.

Private Sub TabPage1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabValues.Click, TabPage1.Enter, TabPage2.Enter
Dim err = "", status As String = ""

[code].....

View 1 Replies

Inner Join In Linq To Entities?

Apr 23, 2009

Given two tables, customer and orders, how would one do a linq query to entities to find any customers with open invoices started before a certain date?

View 1 Replies

Link Up Different Entities On Submit Changes?

Nov 15, 2011

I am just digging into L2Sql and I am a little confused on what to do about inserting several records into my database that are related.

For example:

I have an entity mapped to a user table called user. This class contains UserId and Username.

I have an entity mapped to a preference table called preference. This class contains PrefId, PrefName, UserId.

I have an entity mapped to a profile table called profile. This class contains ProId, ProName, UserId.

When I ask a user to register for an account, this will populate a User object. I will then create two "blank" objects to relate to this user, a profile and a preference.

I notice that the dbml has a User property on both the profile and prefernce entities. Am I right in thinking that if I pass the User object to this property, this in turn sets the UserId for these objects?

If thats the case, when do I actually do this? Surely I would need to InsertOnSubmit the user object, query it back to get the Id and then pass this User object to the others before Inserting them?

At the moment I have this,

Dim reg As New User
reg.Username = username
Dim pro As New Profile

[Code]....

View 5 Replies

XML Resolves Entities On Save?

Aug 9, 2010

I have a simple XML file like so:

<?xml version="1.0" encoding="UTF-8"?>
<foo attr="blah &#176; blah"/>

When I load it into the .NET XmlDocument and issue a Save, i.e.:

xmlDoc = New XmlDocument()
xmlDoc.Load("c: empar.xml")
xmlDoc.Save("c: empad.xml")

the new XML file contains the resolved amp 176 (a degree sign). This then breaks the final black box I'm trying to load the XML into. I've tried playing with the encoding, to little effect. Is it possible for the parser to just echo what came in, without resolving the entities? Inerestingly, it doesn't resolve &amp;#176;

View 1 Replies

Abstraction Between Database Entities And Objects In C#?

Sep 17, 2011

I've just gotten started with development using Visual Studio (though this can be seen as a more language-generic question), and need done design answers regarding how to suitable relate a Database Entity/Table with an Class in-code.

Currently, I create a class who's attributes or iVars directly correspond to the fields in an Entity.

When I come to fetching all 'Customers from a Table' for example, I run a Select all statement against the database and for each result-row returned, I instantiate a new class Object where I use the Class' default constructor to set the instance variables. (I really wish there was a method like PHP's mysql-fetch-object()?)

I can then add each of these objects to say, a List(of Customer) and return it.

This doesn't seem like the best way to do it. If I were to change the Database schema, I'd have to reflect those changes in the class also.

View 1 Replies

Asp.net - Concatenating String In LINQ-to-Entities?

Apr 7, 2011

This code works if I take out

" " + p.MIDDLE_NAME

Thus the remaining code looks like:

p.FIRST_NAME + " " + p.LAST_NAME

Maybe LINQ-to-Entities just doesn't support concatenating more than two strings at a time?

Protected Sub btnFilter_Click(sender As Object, e As EventArgs) Handles btnFilter.Click
Dim dbContext As Campus6Entities = New Campus6Entities

[Code]....

View 1 Replies

Asp.net Mvc - .NET - Efficient Collection Of Database Entities?

Jan 15, 2010

I have a Page class and a PageCollection class in a 3d party ORM framework. I can fill the PageCollection based on parameters (pageid, parentid, url etc..) (SQL query). But I need the data multiple times around the ASP.NET MVC website (Sitemap, Authentication), so I chose to load all pages 1 time and reference that (global) collection.

GlobalClass.Pages //is PageCollection containing all pages

I have now created functions which return a temporary subcollection or single entity based on the parameters mentioned before (pageid, parentid, url etc..).

GlobalClass.Pages.GetByPageId(id) //returns single page entity
GlobalClass.Pages.GetByParentId(parentid) //returns subcollection

The site however got very slow.

cache the subcollections (GetByParent())? create internal hash-lookup tables for the collection? Something else...?

Namespace BLL
Public Class PageCollection
Inherits CustomCollectionBase

[Code]....

View 1 Replies

Databind To A Treeview Using Linq To Entities?

Feb 12, 2010

I have seen other similar questions dealing with WPF Almost exactly the same but I can;tfigure this out in ASP.net. I have a Pages table with a parentpage foreign key and want to databind them to a treeview. In the past I have created a hierarchicaldataset from a dataset but would like to stay within the entities framework if I can

View 1 Replies

EF4: LINQ 2 Entities Query Works In C# But Not In VB

Dec 11, 2010

the query below throws a System.NotSupportedException: "Unable to cast the type 'System.Linq.IOrderedQueryable1' to type 'System.Linq.IQueryable1'. LINQ to Entities only supports casting Entity Data Model primitive types." The exception is only raised in the VB.Net version. When translated to C#, no exception is raised.

Dim doesThisCrash = From outerOrder In orders
Where outerOrder.ProductId =
(From p In products Join o In orders On p.Id Equals o.ProductId

[Code]....

View 4 Replies

Get CurrentTime From SQL Server With LINQ/Entities?

Sep 14, 2011

I am using LINQ with Entity Framework, and I need to get the SQL server timeCan anyone tell me how can I create a method so it retrieves the current server time?

View 1 Replies

VS 2008 Linq 2 Entities Can't Add An Association

Mar 21, 2009

I'm a bit of a n0ob to all this and I'm having trouble finding good resources on the net.What I'm trying to do is define a one-to-many relationship between two entities. I'm using the GUI tool in Visual Studio - and have created the tables in Microsoft SQL Server Management Studio.Basically, I have two tables....a 'Users' table and a 'Sites' table. A single user can have many sites associated with it.Users has a primary key of 'UID' and the Sites table as a primary key of 'Site_ID'.Sites also has a column 'UID' that should indicate which user that site is associated with.Anyway - it sounded pretty simple; but no matter what I attempt to do, I can't seem to get it to work. Mostly, I get validation errors - sometimes run-time errors, or sometimes, no actual data even though there should sites that match the UID of the user.I am able to connect and write LINQ against my Users table/pull down User objects - but can't seem to get it to know that the Sites are associated with the user.In the GUI - if I go to 'Add Association' and create a 1 to many link between Accounts and Sites - and Validate - I get an error saying, "Error1Error 11008: Association 'AccountsSites' is not mapped."

It seems like, when I try to make an association, it wants to link the 'Keys' of each entity.But U_ID and SITE_ID are the keys and, obviously, shouldn't match.If I click on the line it created in the GUI and I go to 'Table Mapping' I can see that it is trying to match those keys. Since I want it to match user_ids my first thought is to just make the U_ID the entity Key in the Sites entity but, of course, that's wrong because it would no longer allow a 1 to many relationship.

View 1 Replies

Communications :: Track Entities Id's From Client To Server?

Apr 17, 2012

Well first off let me say I am not sure if this should be in network or game programing but I think network programing is more relevant.

Anyway

I am creating my first game that runs over a network and so far everything is working. I have a server program, the clients can connect and see each other flying around. (weeeee)

However I have hit a wall when trying to make them shoot. The most easy way I can think to do this, is to have the client tell the server �hay i need a bullet pointing at x angle moving at y speed� the server then spawns a bullet entity then sends a spawn entity packet to all the clients. The main problem I see with this, is that the clients gun will have a delay based on latency.(funValue -= 1000)

The only other way I can think to do this, is to have some fake bullets spawn on the client but when the client gets the spawn bullet packet from the server, I am not sure how to keep track of what fake bullets to delete.

View 1 Replies

Linq To Entities Query With Child Objects?

Oct 13, 2011

Basically I have the follwing:Dim ctx As New AdminCoreEntities Dim roles = (From r In ctx.Roles where r.Name.StartsWith("cust") Select r) 'list of System .Linq.IQueryable(Of AdminCoreModel.Role)

[code]...

The error i get when i run this is: Unable to cast object of type System.Data.Objects.ObjectQuery`1[AdminCoreModel.Role] to type AdminCoreModel.Role

Basically I have a many to many situation and I try to get all the Quicklinks objects queried by their roles and not quite sure why EF will cast to a single AdminCoreModel.Role when i.Roles is a collections of objects.

View 1 Replies

Linq To Entities, Filter Using Where And A List Of Stings?

Nov 2, 2011

I am trying to write a query for an existing database, I am using LINQ on EF3.5 inside VS2008 as that is the only environment available to me.I have a starter query that gives me a list of items so the user can select what they want.

"e.Result =
From c In MLDb.TBL_FeatureInfoSet
Order By c.INSP_ROUTINE_NM
Select c.INSP_ROUTINE_NM
Distinct"

The user can then select from the list one or several items they are intersted in and i want to use these as the filter in a further database call. It's not then difficult to have a where to filter on one string however, I would also like to be able to allow the user to select several items from the list box and the data for all of those to be returned.

[Code]...

View 2 Replies

Update An Object's Foreign Key Value With LINQ To Entities

May 4, 2012

[code]How do I update the ProdServiceID in the database using LINQ to entities?

View 1 Replies

.net - Detect Empty Results In A Linq-To-Entities Query?

May 29, 2009

The only way I know of is awkward:

'check for empty return
Dim count As Integer = (From s In myEntity.employee Where employeeID = myEmployeeIDVariable).Count
'If there is a record, then process

[code]....

View 2 Replies

.net - In Linq To Entities - How To Do An Inner EXISTS (SELECT 1 FROM - Type Of Query

Mar 6, 2011

I am trying to write a LINQ equivalent of

SELECT C1, C2, C3
FROM T1
WHERE T1.C4='xyz' AND
EXISTS (SELECT 1 FROM T2
WHERE T1.C17 = T2.C24)
ORDER BY C3

I'm using EF CTP 5, so I have a DBContext variable named dbc, which includes DBSet objects T1s and T2s, based on POCOs T1 and T2.

In LINQ I write

DIM IND = From i In dbc.T1s
Where i.C4 = "xyz"
And (From t In dbc.T2s Where i.C17 = t.C24).Any
Select i.C1, i.C2, i.C3
Order By C3

Running the query I get the error message "Unable to create a constant value of type 'T2'. Only primitive types ('such as Int32, String, and Guid') are supported in this context." When I omit the inner expression (third line in the LINQ code), the query runs fine. I tried switching the orders of the inner comparison, to be t.C24 = i.C17, with no effect.

View 1 Replies

Asp.net - LINQ To Entities Does Not Recognize The Method System.ObjectCompareObjectEqual

Mar 21, 2012

I had a code segment on an asp.net page in the code-behind file. I decided to move it into a public subroutine in a module (general_functions.vb). Once I did this, however, the code no longer works - it throws an error. On the original code-behind I replaced the original code with a call like so:

[Code]...

View 1 Replies

Cached Entities Making Round Trip To Database?

Jan 9, 2012

i am caching objects, if i make linq queries on cached entities then... will theses queries make database round trip due to lazy loading in Entity framework?

View 1 Replies

Impliment A ISaveOrUpdateEventListener To Set The Datecreated And Dateupdated Fields On Entities

Aug 8, 2011

I'm just starting out a new project, and am trying to impliment a ISaveOrUpdateEventListener to set the datecreated and dateupdated fields on my entities.
I've been trying to follow a simplified version of the solution found here: [URL] Here's my listener:

[Code]...

View 1 Replies

LINQ To Entities .Any() Results In Null Reference Exception?

Nov 16, 2011

I have a simple query as below:

Dim sizings = From a In db.Sizings
Where a.Customer.ID = customer.ID
Select a
If sizings.Any Then
.....

The sizings.Any line is throwing a null reference exception. I thought I was meant to use .Any to determine if there were any rows returned?isnothing(sizings) returns false.

Edit - Resolution:Don't use null objects in the LINQ Query!

View 2 Replies







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