Click here to Skip to main content
15,889,216 members
Home / Discussions / C#
   

C#

 
GeneralRe: OnEnter Event Pin
miah alom22-Aug-05 5:02
miah alom22-Aug-05 5:02 
GeneralRe: OnEnter Event Pin
miah alom22-Aug-05 5:59
miah alom22-Aug-05 5:59 
GeneralRe: OnEnter Event Pin
Agyeman22-Aug-05 8:02
Agyeman22-Aug-05 8:02 
GeneralRe: OnEnter Event Pin
nidhelp22-Aug-05 22:02
nidhelp22-Aug-05 22:02 
GeneralRe: OnEnter Event Pin
Agyeman23-Aug-05 2:44
Agyeman23-Aug-05 2:44 
GeneralRe: OnEnter Event Pin
Agyeman23-Aug-05 2:49
Agyeman23-Aug-05 2:49 
GeneralRe: OnEnter Event Pin
nidhelp23-Aug-05 5:46
nidhelp23-Aug-05 5:46 
Generalaccess autonincrement question Pin
theStorminMormon22-Aug-05 3:58
theStorminMormon22-Aug-05 3:58 
I have an MS Access table that I'm accessing from C# (via MSDE 2000). The primary key in the table is just an int column with identity set to "yes" and step set to '1'. So whenever I add a record Access automatically gives it a new primary key. Yay.

That works fine, but what I'd really like is to be able to retrieve the key that Access generates at the time that I insert the new record.

So right now my C# program just figures out the values for the non-primary keys and then sends an INSERT INTO command. Is there anyway to automatically retrieve the new ID that Access generates?

The only idea that I have so far is to create an additional column in the table called "isNew" or something. When the user submits the new record, the SQL statement could set the "isNew" column for that record to the user name. Then I could immediately send a SELECT to retrieve the ID WHERE isNew = 'user name'. Of course, then I'd also have to send yet another UPDATE to SET isNew = ''. So it's kind of a cumbersome solution, but at least it will work.

Anyone have anything better?

The ends can never justify the means. It is the means that determine the ends.
GeneralRe: access autonincrement question Pin
Guffa22-Aug-05 5:38
Guffa22-Aug-05 5:38 
GeneralRe: access autonincrement question Pin
theStorminMormon22-Aug-05 5:43
theStorminMormon22-Aug-05 5:43 
GeneralRe: access autonincrement question Pin
miah alom22-Aug-05 5:57
miah alom22-Aug-05 5:57 
GeneralRe: access autonincrement question Pin
Guffa22-Aug-05 6:38
Guffa22-Aug-05 6:38 
GeneralHorizontal Scroll Bar Pin
zaboboa22-Aug-05 3:47
zaboboa22-Aug-05 3:47 
GeneralRe: Horizontal Scroll Bar Pin
miah alom22-Aug-05 4:58
miah alom22-Aug-05 4:58 
GeneralRe: Horizontal Scroll Bar Pin
zaboboa22-Aug-05 6:17
zaboboa22-Aug-05 6:17 
GeneralRe: Horizontal Scroll Bar Pin
Dan Neely22-Aug-05 7:06
Dan Neely22-Aug-05 7:06 
GeneralRe: Horizontal Scroll Bar Pin
zaboboa22-Aug-05 7:29
zaboboa22-Aug-05 7:29 
GeneralGrading out DataGrid Pin
zaboboa22-Aug-05 3:18
zaboboa22-Aug-05 3:18 
GeneralRe: Grading out DataGrid Pin
miah alom22-Aug-05 4:57
miah alom22-Aug-05 4:57 
Generaltree view question c# Pin
fady_sayegh22-Aug-05 3:13
fady_sayegh22-Aug-05 3:13 
GeneralRe: tree view question c# Pin
miah alom22-Aug-05 5:51
miah alom22-Aug-05 5:51 
GeneralRe: tree view question c# Pin
Robert Rohde22-Aug-05 8:56
Robert Rohde22-Aug-05 8:56 
GeneralContext Menu's Pin
exhaulted22-Aug-05 3:03
exhaulted22-Aug-05 3:03 
GeneralChanging the service name at installation time Pin
ankit.singhal@gmail.com22-Aug-05 2:34
ankit.singhal@gmail.com22-Aug-05 2:34 
GeneralRe: Changing the service name at installation time Pin
miah alom22-Aug-05 5:53
miah alom22-Aug-05 5:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.