473,396 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

LinqDataSource. Get ID

Hello,

How can I get the ID (primary key) of a record just inserted in a
database table by a LinqDataSource?

Thanks,
Miguel
Dec 18 '07 #1
1 1777
On Dec 17, 9:05 pm, shapper <mdmo...@gmail.comwrote:
Hello,

How can I get the ID (primary key) of a record just inserted in a
database table by a LinqDataSource?

Thanks,
Miguel
Handle the LinqDataSource's Inserted event and get the Result property
from the event args:

protected void MyLinqDataSource_Inserted(object sender,
LinqDataSourceStatusEventArgs e)
{
Whatever thing = (Whatever)e.Result;
//id is in: thing.<idcolumn>
}

-Michael Placentra II
Dec 23 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: shapper | last post by:
Hello, I have a LinqDataSource connected to a GridView. I created the following deleting event: Private Sub ldsTags_Deleting(ByVal sender As Object, ByVal e As...
0
by: =?Utf-8?B?UmFzbXVz?= | last post by:
I have a simple LiveView control that databinds to a LinqDataSource that maps to a table like this: CREATE TABLE MyTable (Id int NOT NULL, Name nvarchar(50) NULL, Picture image NULL) The OR...
1
by: shapper | last post by:
Hello, I have a ListView connected to a LinqDataSource. It uses a table, named Tags, with 2 fields: TagId and Text. I need to add a column named active. For this I created a LinqDataSource...
0
by: Marius Manolea | last post by:
Hi, I have a strange problem, I don't receive any modifications from listview in edit mode (OldValues & NewValues are empty) <asp:ListView ID="lvEditPersonRoles" runat="server"...
2
by: =?Utf-8?B?UGhpbGlw?= | last post by:
I am attempting to insert a simple record with LinqDataSource from a ListView, however I always get a message saying "....LinqDataSource 'dataSource' has no values to insert. Check that the...
3
by: david | last post by:
I've bound my GridView to a LinqDataSource control, but now I want to do some work in the RowDataBound event. protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { var...
5
by: =?Utf-8?B?UGhpbGlw?= | last post by:
I am using the LINQDataSource. I want to use a Parameter to for Select which is essentially a value within a code variable. I have tried using inline code for the asp:Parameter DefaultValue,...
0
by: Andy B | last post by:
I have a GridView with a LINQDataSource attached to it. My code in the aspx markup is below. I need to know why only the checkbox field for the activated column is getting updated (the...
2
by: mesut | last post by:
Hi colleagues, how can I configure a linqdatasource in code behind. I mean I would like to create the linqdatasource programmatically in the code behind rather then dropping from the toolbox. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.