[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 457
  • Last Modified:

Gridview Identity Seed Value

I have a fairly standard gridview in my application.  The first column is EmpID.  I have added an insert command to my gridview by putting a blank textbox in the <FooterTemplate></FooterTemplate> of each of my columns.  When I perform the import, I want the EmpID to be read only and it to automatically increment to the next possible value in the dB.  It is set as a seed value (increments by 1) already.

Any ideas as to how I would implement this?
0
goodmanro
Asked:
goodmanro
  • 3
  • 2
1 Solution
 
Jojo1771Commented:
If its set to auto increment, shouldn't it auto increment without any code. Just insert all the other values? I'm sorry if I'm not much help.
0
 
Jojo1771Commented:
Let me ask you one more question. Is this Gridview tied to a dataset? And if so are you inserting the import to the DS or directly to the DB.
0
 
goodmanroAuthor Commented:
This gridview is tied to an asp:SqlDataSource.  I tried simply inserting into the dB, but I get a NullExceptionReference for the EmpID field.  Is there somthing that I could do possibly with setting a variable equal to SELECT MAXCOUNT?
0
 
goodmanroAuthor Commented:
Is there a way to SET IDENTITY_INSERT ON in a code behind file?  I see how this works in a SP and this could possibly be a solution...
0
 
goodmanroAuthor Commented:
This question has been resolved.  Thank you.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now