Groups
Groups
Sign in
Groups
Groups
CSVChat
Conversations
About
Send feedback
Help
Get id of new row during reading csv file.
18 views
Skip to first unread message
Борис Илларионов
unread,
Mar 24, 2016, 8:40:45 AM
3/24/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to CSVChat
Hello! Is it possible to get id of new row before inserting to database?
Thanks for advace!
shriop
unread,
Mar 24, 2016, 9:04:49 AM
3/24/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to CSVChat
Are you talking about when using SqlBulkCopy? If so, the only way to know the id of an identity column before it has been inserted into the database would be to calculate it ahead of time and insert values for the identity value instead of letting the database assign them. To do this, you have to set KeepIdentity on the SqlBulkCopyOptions,
https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopyoptions.aspx
. If you're using DataStreams, you'll also probably be using the ReadRecord event to set the identity value,
http://www.csvreader.com/csv/docs/html/E_DataStreams_Common_DataReaderBase_ReadRecord.htm
.
Bruce Dunwiddie
Reply all
Reply to author
Forward
0 new messages