Linq to sql - object designer - Getting values from active object

Hi.

I have a winform and a few texteditfields. These are bound to the
result from a linq query:

var person = ProjectGlobal.rd.ER_Persons.Single(c => c.LogonId ==
ALogonId.ToUpper());

The query gets the person of the entered logon-id. Next, the persons
departments are feched:
var sections = from s in ProjectGlobal.rd.ER_Person_Sections
                     where s.Person_Id == person.Person_Id
                     select s;
The results from this query is databinded to a DataGridView. The
result columns is Person_Id and Section_Code. And these two columns
are then shown in the grid.

the problem is: when I add a new record to the grid, I need to set the
Person_Id automatically and let the user choose a section code from a
drop down list in section_code.

#1:
How do I set a value to a grid cell?

#2:
How do I get the person-id from the first query - the active object -
and put it into the cell in the grid?

Thanx in advance,

Fritjolf
0
Fritjolf
4/7/2010 2:52:51 PM
dotnet.languages.csharp 1931 articles. 0 followers. Follow

1 Replies
873 Views

Similar Articles

[PageSpeed] 4

Fritjolf wrote:

<snipped>

When I have questions about ADO.NET Entity Framework, I post to the forum.

http://social.msdn.microsoft.com/forums/en-US/linqtosql/threads/
0
Mr
4/7/2010 3:50:09 PM
Reply:

Similar Artilces:

edit Activities Associated View of Account
Is it possible to change the Associated view of the Activities in an Account Form? Unfortunately some links were left out of the Views Customisation module. Using these url's you can access the respective views and modify them. Open the URL in a web browser and copy the required link below - make sure you substitute "CRM Server" with the name of your actual crm server. View: Closed Activities: http://crmserver/tools/viewEditor/viewManager.aspx?id={00000000-0000-0000-00AA-000010001901} View: All Activities: http://crmserver/tools/viewEditor/viewManager.aspx?id={00000000-0000-0...

how to convert a cell value into boolean
Hi. I'm facing up the following issue: in a sheet there's a matrix of boolean values (TRUE, FALSE) that I have to read/write via vba. Sometimes (not deterministically), a statement like: if Cells(2,4).value then ' do something else ' do something else end if returns a type mismatch because it reads the cell as string and not as boolean (obviously in Cells(2,4) there is a TRUE value). This behaviour doesn't always happen, only sometimes (non deterministically, as previously said). The solution that I've thought to is to force the format of the cell as boolean, bu...

Possible to close a 'group' of activities
Sooo, in my zeal to play with this version, I created a quick campaign that generated around 2500 letters to leads (I really did this through the partner direct site), so I want to track that letter in the history. Around 2500 letters have been created for me to manage in 'Activities', instead of 'History' for the Lead. I don't see an intuitive way to select a group of activities and quickly close that activity. Instead it appears as if I have to open each one, go to the Action menu, choose close letter, and then close the activity. This might age me in dog ye...

Opening multiple workbooks through code and copying values
Help! the following code 'kinda sorta' does what I want, but it has 3 problems. 1. Instead of going on to the next file if the file doesn't exist, it pastes the data from the previous file. 2. It closes the workbook into which I am compiling data instead of just the ones I am copying from. 3. Everytime it closes a file, it asks the question about 'large amounts of data in the clipboard.' Thanks, Pam Here is the code: Private Sub cmdCreate_Click() On Error GoTo Report_Err Dim myPath As String Dim myReport As Object Dim mySheet As String Dim myRow As Integer Dim x...

Passing Values between forms
Hi, I have a "keyboard" form that I would like to reuse through out my application... Let's say in Form1 I have a text box or property I want to populate... I want to be able to call the "FormKeyboard" which has a textbox that gets populated with the value typed by the user. I then want to transfer this value back to the Calling Form... How may I make "FormKeyboard" generic enough to be useable form any form ? Thanks Robbie has brought this to us : > Hi, > > I have a "keyboard" form that I would like to reu...

Copy the value from a cell with condition. Help please
Hi, I have a column with say 100 cells. There are several 0s in this column. What is the conditional formula to put ONLY the values different from 0 to another column whitout cells with false or white spaces? Thanks -- excel_guest ------------------------------------------------------------------------ excel_guest's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=35590 View this thread: http://www.excelforum.com/showthread.php?threadid=553539 if(A1="0","",A1) -- Mallycat ---------------------------------------------------------------...

Hidding zero values
Hi all, I know how to hide all zero values in 2003, but the problem is only want to hide zero values of selected rows. Is there anyway to do this? You would probably be best using formula =IF(A1=0,"",A1) A simplistic view of the formula but thats it, or you can create a custom view if they are always the same cells at the same time. Steve J;579642 Wrote: > Hi all, > > I know how to hide all zero values in 2003, but the problem is only > want > to hide zero values of selected rows. Is there anyway to do this? -- Simon Lloyd Regards, Si...

SQL and DLookup
Can you use DLookUp in SQL? Test2SQL = "UPDATE table1 IN '" & strPath = DLookup("BackName", "tblBackPath", "BackID=1") & "' " & _ "SET table1.IDName = '" & Forms!Form1!TxtInfo & "' " & _ "WHERE table1.IDNumber = 1;" DoCmd.RunSQL (Test2SQL) Thanks DS DS wrote: > Can you use DLookUp in SQL? > > Test2SQL = "UPDATE table1 IN '" & strPath = DLookup("BackName", > "tblBackPath", "BackID=1") & "' " &...

Change default value without influencing old records
There are the following tables: tblSuppliers supplierName (PK) invoicePaymentTime (other fields) tblGoods goodsID (PK) goodsName supplierName (FK) Each time I choose a "Supplier Name" I want "Invoice Payment Time" to be filled with a corresponding value (30,60 days etc.). My form uses a combo box for supplier name which asigns these values. QUESTION: In case "Invoice Payment Time" for a supplier changes (30 -> 45 days) I want a new value to be used for new records and don't modify existing ones. The above described design doesn&#...

GUID Columns in SQL 2005
Are there additional things you need to do when backing up and/or restoring databases which have tables containing guid/uniqueidentifier columns? Thanks in advance Please, ignore this question. "RG" wrote: > Are there additional things you need to do when backing up and/or restoring > databases which have tables containing guid/uniqueidentifier columns? > > Thanks in advance ...

search after values
Worksheet nr1 haves values by days and reasons. Line 1 Left Fight Top Bottom Centre And this for 6 lines and a total overview. each day in a new column of course Worksheet nr 2 must search after values by special lines or data selected by hand. Par example: What are the numbers for 15 may 2005 and for line 4? Ho can help me? I' m from Belgium, and hope you all can understood my "English" ...

Macro to match 2 column values in different sheets
Hi, I need a macro which compares the values in colA and colC of sheet 1 to column D and column E of sheet 2, if both the value match, then it copies the contents from sheet2 col F,G and H into sheet1 colC,D and F. I tried the code below but I got an error message saying:Subscript out of range Please advise if any modifications required in the following code: Thanks Sub CompareThis() For iRow = 1 to 1000 If Sheets("Sheet1").cells(iRow, 1).Value = Sheets("Sheet2").cells (iRow, 4).Value And _ Sheets("Sheet1").cells(iRow, 3).Value = She...

LOOK UP Value
Hi guys! Has anyone had an idea how to or what is the formula that can be used to get the value from a sentence in a worksheet column? example: abcd 100 abcdef 10 abcdefgh 200 I just wanted to get the value of each data in a row. I hope someone can help me. Thank you guys in advance. This works for your sample data where the number follows the one and only space in the 'sentence': =RIGHT(A1,LEN(A1)-FIND(" ",A1)) returns the right portion as text =VALUE(RIGHT(A1,LEN(A1)-FIND(" ",A1))) actually returns the right portion as a number. "joey...

Design my own comapny logo?
Im starting my own company and need to design a company logo. Is there somewhere I can get free software that will allow me to design my own professional looking logo? I want to design it then take to printing company to have put on letterhead, business cards, etc. Ron N wrote: > Im starting my own company and need to design a company logo. Is there > somewhere I can get free software that will allow me to design my own > professional looking logo? I want to design it then take to printing company > to have put on letterhead, business cards, etc. Try http://www.freeseri...

Excel and SQL Server
I am looking to integrate Excel and a back end MS SQL Server database. The database is running on MS SQL server and has statistical information for help desk agent call stats. I want to create a spreadsheet that can query the database and provide certain information about agent stats, to our agents. Something the agents can use to keep up to date with their performance. I have a general idea of how to do this, but am looking for an Excel book that can assist me with this. Something beyond the basic, and with some depth in SQL database integration. (Note: I am not a programmer, but have hav...

Programmatically Update a Form's Combo Box Default Value and SQL Record Source
I have one Sales Activity form that I use for data entry and for viewing all records by Sales Person (EmployeeID). Without having to have multiple instances of this form, I want to accomplish the below; based on which EmployeeID (sales person) opens the form in either mode: 1. For the data entry mode – I want the Combo Box’s Default Value to change, based on my user (EmployeeID); 2. Show All Records mode – I want the SQL record source to filter on that sales person’s records (EmployeeID) I’ve got some code for passwords, so I hope I can utilize that part of it; I just do not know how to do ...

Higher value in cell b Than in Cell A
The user inputs numeric data into cells c7 to j7. The values must b higher than the value in cells c6 to j6. IE: The data is already present in c6 to J6. C6 must be a higher value than C7 D6 must be a higher value than D7, etc, etc is there a way to make this work -- Message posted from http://www.ExcelForum.com You could try select C7:J7 with C7 as the active cell, do data>validation>allow custom and in the formula box put =(C7>C6)*(ISNUMBER(C7)) -- Regards, Peo Sjoblom "mikewild2000 >" <<mikewild2000.10xfio@excelforum-nospam.com> wrote in messag...

LINQ to XML - Performance
Hi, Can anyone tell me how the performance compares between working with xml documents in the normal way (i.e. with xpath and the System.Xml) and LINQ. Is it any quicker or slower? Are there are distinct benefits to the user (and not just advantages for the coder) to working with LINQ? The work i will be doing is creating an xml document out of segments from other xml documents, transforming the document (XSL) and then retrieving/amending/appending data to the document. Currentlly xml transformations in .net 2.0 are very slow and performance takes a real hit with complex transforms. ...

Retrieving Active Directory User Name into Access 2003 table
It seems like there would be an easy VBA call to do this, but I have not found it yet... I am trying to grab the Active Directory User Name (the user name that is used to log into WinXP professional by the user) in order to populate the user name in a transactional database. Is there some simple (or not simple) VBA code that is out there to accomplish this? Perhaps something internal to Access 2003? Take a look at www.mvps.org/access and browse the API section (and everything else, too :-), you will find a solution there. hth -- Jack Leach www.tristatemachine.com &...

Trying to Modify Excel code; Pointing to SQL Server Instead of Acc
I played with the code here: http://www.rondebruin.nl/accessexcel.htm Got that working quick, but now I'm trying to modify the to point to my SQL Server, and having a heck of a time getting it going. In Excel, I have set a reference to ‘Microsoft ActiveX Data Objects 2.8 Library’ The code in ‘MainMacro’ is the same. I changed Sub Test4 a bit; now like this: Sub Test4() Dim con As New ADODB.Connection With Sheets("test") con.Open "Provider=SQLOLEDB;Data Source=LAPTOP\SQL_EXPRESS;Initial Catalog=;Integrated Security=SSPI;" GetDataFromAccess &quo...

When to stop with Access and go to SQL Server
Our dept has several Access applications that could have the potential to grow with user base and no doubt grow with data. Does anyone have a good list of 'checkpoints' to know when an application is beyond Access as far as usefulness goes and is ready to be migrated over to SQL Server 2005? thnx.... RLN Let me qualify a statement I made in my original post. "...as far as usefulness goes" should have been phrased, "...as far as performance goes" ....thnx "RLN" wrote: > Our dept has several Access applications that could have the potential to...

Macro: set filter containing certain value(s)
Hey guys Again I consult my helping friends: I have a list of COMMENTS listed in column D, and dynamic cellvalues "X" in range E1, "Y" in range E2 and "Z" in range E3 (based on linked cell of comboboxes). Now I want my macro to set a filter in my list D to only show the exact filtered list where COMMENTS are containing either of the 3 words "X" "Y" or ""Z". Will anyone kindly help me on this one? Best regards Snoopy In xl2003 and below, I can only use two criteria for my autofilter. So I'd either use ...

how to update member value correct
Hello! I'm reading a book called programming Visual C++. The book says "Finally, you need to update the trackbar's m_nTrackbar1 data member when the user clicks OK. Your natural instinct would be to put this code in the OnOk button handler. You would have a problem, however, if a data exchange validation error occurred involving any other control in the dialog. Your handler would set m_nTrackbar1 even though the user might choose to cancel the dialog. To avoid this problem, add your code in the DoDataExchange function as shown below." if (pDX->m_bSaveAndValidate...

item barcodes and sql query
This is a multi-part message in MIME format. ------=_NextPart_000_0007_01C89274.4D47EC80 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hello, Customer forgot to set the right barcodes for the items they left it blank. Customer would like to print labels but since they did not specify the right barcode types in the item properties I guess it will not work. So is there a sql query that can do that? For example I would like to it to use upca for all items, since almost all of their products are upca's. Thank you. ------=_NextPart_000_0007_01C...

Database Path from DSN (SQL Server)
I'm trying to get the full path of my .mdf database from a DSN on a shared WinXP drive (running MSDE). I've tried the following: (using MFC6, SP6) SQLGetInfo(g_db.m_hdbc, SQL_DATABASE_NAME, &sMyDatabase, lSize, &bytesreturned); SQLGetConnectAttr(g_db.m_hdbc, SQL_CURRENT_QUALIFIER, &sMyDatabase, lSize, &lLengthReturned); SQLGetConnectAttr(g_db.m_hdbc, SQL_ATTR_CURRENT_CATALOG, &sMyDatabase, lSize, &lLengthReturned); All the functions return the name of the database but not the path. The path is not in the registry so I can't use those functions either. An...