.net - Querying Twice-separated-or-more Objects In A Relation Chain?

Apr 20, 2010

Not sure if I am using the correct term, but it's not child/parent since they aren't nested objects. In my application I've got a User, UserUserGroup, and UserGroup objects which are pretty standard, UserUserGroup is a linking object with corresponding IDs. I am using Linq-to-SQL so unforunately it doesn't used nested objects, but it still knows the relation.

[Code]...

View 1 Replies


ADVERTISEMENT

What's The Relation Between Classes And Objects

Oct 14, 2009

relation between Classes and Objects with an example.Md. Marufuzzaman

View 7 Replies

Querying An Array Of Invoice Objects (LINQ)?

Sep 19, 2009

I am having a little problem with some homework. Here is the problem:Use the Invoice Class provided to create an array of Invoice Objects. Class Invoice includes four properties- a PartNumber (type integer), a PartDescription (type String), a Quantity of the item being purchased (type Integer), and a Price (type Decimal). Write a Console Application that performs the following queries on the array of Invoice objects and displays the results:

[Code]...

View 3 Replies

VS 2008 - Querying Array Of Invoice Objects (LINQ)

Sep 20, 2009

Use the Invoice Class provided to create an array of Invoice Objects. Class Invoice includes four properties- a PartNumber (type integer), a PartDescription (type String), a Quantity of the item being purchased (type Integer), and a Price (type Decimal). Write a Console Application that performs the following queries on the array of Invoice objects and displays the results:

a. Use LINQ to sort the Invoice Objects by PartNumber
b. Use LINQ to sort the Invoice objects by Price
c. Use LINQ to select the PartDescription and Quantity and sort the results by Quantity
d. Use LINQ to select from each Invoice the PartDescrition and the value of the Invoice (i.e. Quantity * Price). Name the calculated column InvoiceTotal. Order the results by InvoiceTotal.
e. Using the results of the LINQ query in Pard d, select the InvoiceTotals in the range of $200 to $500

I am pretty sure I have parts a, b, & c completed correctly. Or at least the provide the desired results. Part d I figured out how to multiply the 2 fields but can't create a new column for the result or figure out how to show the PartDescription with the multiplied result. Part c I think I can figure out when I get part d. I already coded what I think will work for part c.

Below are the 2 Objects the Invoice was given and not to be changed & the LINQ is the one I have been working on.
Module LINQ
Sub Main()
' array of invoices
Dim invoices As Invoice() = { _
New Invoice("83", "Electric Sander", "7", 59.98), _
[Code] .....

View 3 Replies

Chain A Null Coalesce Operator?

Oct 25, 2011

I have a class Customer which contains the property Extensions which in turn contains the property Any. I tried to do: Dim room = If(customer.Extensions.Any.ElementAt(0).InnerText, Nothing) but it threw an error when it did not find an Extension element in the incoming xml. I thought it would return nothing once it saw that the first expression was Nothing. Do I have to do a multiple if statement in this case?

View 1 Replies

Implementing Class With Chain Of Inheritances

May 30, 2009

Usually, if I make a class that has an implementation and also inherits a class with same method signatures, then I do not need to manually add implementation code. For example, if I create a class that inherits List(of Double) and Implements IList(of Double), then I do not need to add any code to make this compile, since the program realizes that the inheritance covers all the methods of the implementation. (Even though VB will auto-generate methods you can remove them no problem).

Now I'm trying do to something more complicated, using an implementation on top of IList, with a class that has a chain of inheritances, and the program won't accept it. See this example:

Interface ICustomList
Inherits IList(Of Double)
Sub TestSub()
End Interface
Class BaseList
[Code] .....

The final item, CustomList, is not compiling. The program says 'TestSub' must be implemented, but by inheriting BaseList, the class has a TestSub (and it is recognized by intellisense)! All the subs exist, they are functional, so why is the implementation not valid? (I know I can get rid of this error by manually creating an (overloading) TestSub in CustomList and specifying that it is an implementation. However, this should not be necessary since it already exists, and if I am going to be building a chain of classes inheriting each other, this could potentially become time-consuming and annoying.)

View 1 Replies

Linq Expression Chain Syntax For In Query?

Feb 25, 2011

I have a query that I cannot seem to replicate in expression method chain syntax. I have two tables "User" and "UserPayment". User and UserPayment have a one to many relation i.e. One User can have many UserPayments.

View 1 Replies

POS Button Interface For A Restaurant / Food Chain

Mar 15, 2012

I'm making this POS software for a restaurant and I was wondering what the best way to create the button interface for the items since it's going to use a touch screen monitor.
I was thinking of adding the buttons at runtime to solve the excess space problem, and also add the code at runtime, but that seems like too much work, so I thought I should ask if there are any other ways to approach the problem?

[Code]...

View 1 Replies

Comma Separated Value Find The Value In A Comma Separated String?

Jul 11, 2011

I have a string like

human, roti, makan, ghar, house, language, english, india, US, master, teacher, html, code, asp, jsp

i need code for find the input string.

View 3 Replies

.net - Visual Studio 2008 Build Dependency Chain?

Feb 22, 2009

I am having an issue with Visual Studio 2008 SP1. Basically, I have a .NET 3.5 solution with a client, shared and server component. While coding, all components run on the same box, but in production the server component is a standalone (remoting) service running on a separate server.

I would expect that a change to the client component would require only a rebuild of that component as there is no client/server dependency. This is in fact how it works on my work PC. However, on my personal PC and another co-worker's PC, any modification - even a simple label change on the client, requires the server component service to be stopped so that the solution can be rebuilt in its entirety. Does anyone know if there is a particular setting that controls this??

View 2 Replies

Does Dispose(disposing As Boolean) Need Implementing For Every Class In A Chain

May 9, 2012

I'm trying to work out whether every Class in an Inheritance chain needs an explicit Dispose(disposing As Boolean) method or, if a given Class has neither managed nor unmanaged resources to dispose of, it can be skipped for that Class - even if a latterClass does require a Dispose method to dispose of mananaged or unmnaged resources?

Here's two examples:
Public Class BaseClass
Inherits Component 'Component has already implemented IDisposable

[code]....

View 15 Replies

Large Multidimensial Array - Write A Program To Do Markov Chain But States Are Quite Large

Jun 9, 2011

I want to write a program to do Markov chain, but my states are quite large. First of all I calculate all the transition probabilities and revenues for all states(1381860 total states), and store in a multidimensional array. Public RevArr(0 To 9, 0 To 750, 0 To 282) As Long

After that the iteration of markov chain should use these as inputs to calculate the steady-state probabilities. But when I try to run the main code I got this error.Exception of type 'System.OutOfMemoryException' was thrown.

The following is the declaration of second array I add just another dimension for storing all the iterations, but I get this error. Dim stateprob(IT + 1, 0 To 9, 0 To 750, 0 To 282) As single

View 1 Replies

Get Relation Between 2 Databases?

Jun 7, 2011

I have two dataset , each with with table . each datasets is connected to a separate dataadapter to get data from sql server database file (two different tables SQLtableOrders & SQLtableCustomerA))

datasetOrders.Tables("Orders") >>> the first column "orderID" is a primary unique key. Its structure is details below :
OrderID----OrderName----OrderCost--------Date
1----------A---------------54------------11/11/2010

[Code].....

note that I had already made this by getting the data by SQL Statement "Select SQLtableOrders.* , SQLtableCustomerA.orderID FROM SQLtableOrders, SQLtableCustomerA WHERE SQLtableOrders.orderID = SQLtableCustomerA.orderID" It is really working fine , but the problem that it takes time to get data from the SQL server each time I disply orders. I already have the datasetOrders.Tables("Orders") data on the client PC , I need only to make the client PC extract which orders are assinged to a ceratin customers. I can do it by For... Next , but I guess it will take time , specially if "orders" data contains many data .

View 8 Replies

.net - EF - Only Removes Relation When Hit By Breakpoint?

Jun 7, 2012

<HttpPost()>
Function Edit(<Bind(Prefix:="Article")> ByVal Article As FormCollection, Optional ByVal DepartementID As Integer = 0, Optional ByVal LeverancierID As Integer = 0) As ActionResult ', ByVal ReferenceSupplierID As Integer
' Dim Art As Article = ArticleService.GetArticleById(Article.ArticleID)
Dim _toUpdateArt As Article = ArticleService.GetArticleById(Article(0))
UpdateModel(_toUpdateArt, Article)

[Code]...

toUpdateArt.Departement = Nothing and _toUpdateArt.Supplier = Nothing is to remove the optional relationship.But it only works when i debug it and sometimes after several loops of the command, before the relation is actually removed and it's stored in the database.When there isn't a breakpoint on the "function", the Relationship will never be nulled.Does anyone has an explanation for this and how to fix this?

View 1 Replies

Add A Many-To-Many Relation In Entity Framework?

Apr 17, 2009

I am a newbie. I have been able to Add new entities where there is a One-To-Many Relation. I am having a problem (don't Know how to do it) adding a new Entity when the relation is using Many-To-Many. In my EDM I have:

[Code]....

View 1 Replies

DB/Reporting :: Relation DB Design?

Apr 21, 2010

I am designing a system for our sales team to enter their sales expenses. I have designed an input form and need some advise on what exactly I should store in the expenses table VS lookup from the employee table.

First, the form has a text box where the user must enter their EmployeeID. Management asked for a text box VS a combo box because they do not want users looking at each others expenses. The form has a search feature where by after you enter your employee number, it will look for an existing expense ticket first before allowing you to create a new one. Anyway, here are some of the decisions I have to make.

When the user enters their employee number, I would like to display their employee name. The EmployeeID is saved in the Expense table but should I also store the name in the expsense table? If I do save it, it's duplication of data, if I do not, I have to look it up each time the record is loaded. But is there a point storing the name long term? Does this qualify as related data? If I was to perform some reporting, could this cause a problem if an employee changes their name etc.

The expense data is spread over 2 tables, the first for the header details including employeeID, expense date and Expense ID etc. The second table contains the expense lines information. Amount, customer, category etc. My next question is when the employee chooses an expense category, there is an associated general Ledger code with that category. Again, the expense category data is stored in a table. When the user chooses the expense category, should I store the categoryID or store the values associated with the ID (GLAcct, CategoryDescription etc.) Does this qualify as related data or should lookup values always be duplicated in the master table? It is possible that over time, the GL accounts associated with the Expense categories could change. So for accuracy purposes, should they be stored in the expense lines table?

View 2 Replies

Information With Relation To A Combo Box?

May 5, 2010

I want to have a combo box with a list of names. When one of the names is selected, I want the phone number and email to be displayed below it in a text box (or something similar).

View 6 Replies

VS 2008 Relation Between Two Tables?

Apr 14, 2009

i have two tables ( employees and departments )i want to insert data in employees table via employees form .so how can i put the departments names in a combobox and when the user choose a specific one it will return a department number so i can pass it to the INSERT statement? i mean what is the exact SELECT statement to load the the information to the datatable do i need two SELECT statements or innerjoin or something else?

View 2 Replies

VS 2010 Data Relation In ADO.Net?

Aug 12, 2011

I have two tables populated in a dataset using sql data adapter.. i created relation by specifying two columns in each table.. added it in dataset and made datagridview to show related records.. but it shows only first record...

---code

Dim cons As New String("Data Source=xxxxSQLEXPRESS;Initial Catalog=emp;Integrated Security=True")
Dim sql1 As New String("Select * from tab1")
Dim sql2 As New String("Select * from tab2")

use uniscribe in visual basic?

View 4 Replies

Get The Angle Of A Line In Relation To The X Axis?

Apr 18, 2011

i am trying to get the angle of a line in relation to the x axis. The line is being drawn in a picturebox. So its the Upper right quadrant of the cartesian plane ... but its flipped over the x axis.im using this code

a=pt(1).x
b=pt(1).y
c=pt(2).x
d=pt(2).y

z=math.atan2((c-a),(d-b))*(180/math.pi)

The issue is that the line im drawing is almost parallel to the x axis but its returning a value of roughly 90 degrees .It seems like it is giving me the angle in relation to the y axis, but not being super good at the math myself im not exactly sure what to change here.

View 6 Replies

Combo Box Drop Down Value Relation Between Two Tabs?

Feb 8, 2011

i have a login form that contains a combo box and a text box and a button. the items of the como box are from the databse while the person selected can only log into the system if the password he enters on the textbox matches the password details in the database.(of the name selected)

my problem is, the second tab contains a couple of textboxes and combo boxes that need to be filled in. but i want the first combo box in the second tab to have drop down value of the name of the person that has logged in to fill in the form.

the person login in the first tab, his name should appera on the combo box in the second tab

View 3 Replies

Get A ContextMenuStrip In Relation To The Parent Control It's Under?

Dec 30, 2009

I've made a ContextMenuStrip to use in my program to change the image in a picture box. However, it's used with multiple picture boxes which each need to have their own changed. What I want to do is make my command change only that picture box leaving the others as they were before. An example, if this were a plausible code.

Private Sub TestToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TestToolStripMenuItem.Click
Self(aka the control that currently has the menu open).Image = My.Resources.Picture
End Sub

View 2 Replies

Get The Form Position In Relation To The Screen?

Apr 16, 2011

I have this code working fine , it takes pictures of the correct size and correct file name , however , all the pictures it takes are in the top left corner of the screen , rather than where i have the form to. FYI the picture box in the middle has no picture in it , and is transparent , i want to save a bitmap of the contents of the picturebox ( a user defined size of the screen). The picture box and button are docked so that the form scales properly when being resized.

[Code]....

View 4 Replies

Mouse Position In Relation To Picturebox

Oct 3, 2009

If I do the mousedown event in my picturebox, is there a way to calculate the mouse position in relation to the picturebox itself, or will I have to calculate it from the X/Y of the mouse and the X/Y of the picturebox? I can do the latter, just wondering if there's a command for the former.

View 2 Replies

Relation Between Two Combo Boxes In VB 2005

Apr 11, 2009

i am new to vb2005 and i am developing a project of a restaurant in vb2005. i have two combo boxes of PRICE and SOFTDRINKS. there are 5 different soft drinks and there are five different prices of the softdrinks in the combo box of PRICE. my requirement is that when i select the soft drink in the combo box of SOFTDRINKS then automatically the price relevant to that soft drink should be selected in the combo box of PRICE.

[Code]...

View 5 Replies

Relation For Multiple Columns Between Two Tables?

Jan 8, 2010

<vb.net 2008>
Table : MST_COMPANY / EMP_MASTER
Column : COMPANY_ID / LOCATION_ID

How do I add relations for two colums between two tables? I tried below way but it does not work.
Is there any other way?

Dim relCompanyEmp1 As DataRelation = ds.Relations.Add("relSectionEmp", ds.Tables("MST_COMPANY").Columns("COMPANY_ID"), ds.Tables("EMP_MASTER").Columns("COMPANY_ID"))
Dim relCompanyEmp2 As DataRelation = ds.Relations.Add("relSectionEmp", ds.Tables("MST_COMPANY").Columns("LOCATION_ID"), ds.Tables("EMP_MASTER").Columns("LOCATION_ID"))

[Code]...

View 5 Replies

C# - Relation Table In DataSet Always Returns 0 Rows

Jul 19, 2010

I have created a strongly typed dataset in the VS 2005 Dataset Designer. There are two tables that relates to each other in a one to many relationship: Claim and ClaimDetail. The designer automatically creates a function GetClaimDetailRows which returns all ClaimDetailRows for a ClaimRow. Why is this Array's length always 0? Because ClaimDetail contains more than 40 Million rows, i did'nt fill it before i call GetClaimDetailRows but had configured it's selectcommand that it takes a parameter idData to fill only the related records. But that seems not to work because the ClaimDetail-Datatable is empty.

The automatically generated function in the ClaimRow-Class which returns all related ClaimDetailRows:
Public Function GetClaimDetailRows() As ClaimDetailRow()
If (Me.Table.ChildRelations("Claim_ClaimDetail") Is Nothing) Then
Return New ClaimDetailRow(-1) {}
Else
Return CType(MyBase.GetChildRows(Me.Table.ChildRelations("Claim_ClaimDetail")),ClaimDetailRow())
End If
End Function

When debugging I see that it jumps into the else block but returns 0 rows. Do I have to fill the Claimdetail-Datatable first(ClearBeforeFill=True) for each Claim? But then I don't need to use this function anymore. I now fill the Datatable(ClearBeforeFill=True)before i call the Child-function and it works. But I don't understand why it could not throw an exception(optionally) when I try to acess a child-relation without having that datatable being filled(at least with 0 rows). Instead of that it returns 0 rows what can be correct or incorrect and is difficult to detect.

View 1 Replies

Color.ToArgb Relation Between 5046311 And 14221235?

Sep 2, 2010

the form backcolor is 14221235 , but when i set the customcolor in colordialog to equal the form backcolor, it sets it to 5046311 !!! what is the problem?the reason i am turning it into a string is because i will feed it into a string which has "32498239, 234234234, 23423234, 32234432432, 423324234"then i take this string and put it in customcolors like this. btw this piece of code works fine:

Dim numberStrings = My.Settings.mytext1.Split(","c).Select(Function(x) x.Trim())
ColorDialog1.CustomColors = numberStrings.Select(Function(x) CInt(x)).ToArray()

View 6 Replies

DB/Reporting :: Relation Between Two Similar Data In Two Tables?

Oct 9, 2008

I want to make relationship between them Where In the F column of Table2 will sum the numbers in F column of table 3 according this condition ( show in the pic.)For the same data in columns(B,C,D) between two tables Example: Table 2 include in B,C,D data HH XX FF There are many data (HH XX FF) in tables3 in same columns(b,c,d) so it will sum the numbers in F column that in the same row with the data (HH xx FF), and insertded the results in the in table2 in F colmn in the same row with (HH XX FF)

View 10 Replies

VS 2008 Update Parent & Child With Relation

Aug 7, 2011

I am going to ask a dumb question. I want to update my tables (two). There is a one to many relation between them. I know how to update when only one table is update, but how do i update when there is many on the other side. My problem is that , if one of the records on the many should become redundant, how would i delete it in the update process. If only the content changes , it is not a problem, i know the data just gets written back to the tables, but if one of the child records is not delete, how would it work I need some clue on the SQL statement using OLEDB

View 2 Replies







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