Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
how to insert value of field having autofield data type with access database..???
i need a insert query for this....!!!!
 
Example:-
i have table having two filed (no autonumber,name text)
now i want to take a input from use of name and autonumber do thier work automaticalyy then what will be the insert query ???
Posted 26-Jan-13 17:05pm
Edited 26-Jan-13 19:57pm
v2
Comments
Sandeep Mewara at 27-Jan-13 1:49am
   
Not clear. Please rephrase & Elaborate.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Let's make clear:
A) you want to override the value that would be generated with a value coming from elsewhere?
Sorry, but you can't do that in access Frown | :(
 
B) you want to make the number generation to work?
In this case you simply have to omit totally that field from the insert statement.
  Permalink  
Comments
vkshah1 at 27-Jan-13 23:29pm
   
ya B option is proper but when i omit that field then fire a exception .....!!!! now what to do ??/
Zoltán Zörgő at 28-Jan-13 0:29am
   
If you issue a "select into" statement directly, you should not get any exception. But if you use other tools, where you populate field objects, you should care about specifying on c# side, that the "no" field is autonumber. But the exact way depends on what you are using, so please update your original question with the code sequence you are using to insert.
vkshah1 at 4-Feb-13 4:51am
   
i have table having two filed (no autonumber,name text)
now i want to take a input of name field from user and autonumber do their work by thier own so now tell mw the INSERT query which one i write on my coding page ???
Zoltán Zörgő at 4-Feb-13 5:26am
   
I can't tell more, than I already have. If you use autonumber, you can not override it in an insert statement. That is a limitation in access.
Marcus Kramer at 14-Mar-13 14:02pm
   
My 5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 511
1 OriginalGriff 344
2 DamithSL 235
3 Maciej Los 140
4 Bruno Sprecher 130
0 DamithSL 185
1 OriginalGriff 105
2 Peter Leow 60
3 Maciej Los 50
4 abhijeetgupta1988 45


Advertise | Privacy | Mobile
Web04 | 2.8.141030.1 | Last Updated 5 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100