ahco Posted December 8, 2016 at 02:04 AM Report Share #601104 Posted December 8, 2016 at 02:04 AM (edited) Boa noite, estou aqui com uma dificuldade. o problema é o seguinte tenho datatable typed. E no insert quero obter o último id que introduziu. pelo comand text sei, mas por aqui nunca experimentei, alguma ideia? Edited December 8, 2016 at 11:41 AM by ahco Link to comment Share on other sites More sharing options...
ahco Posted December 19, 2016 at 12:34 PM Author Report Share #601359 Posted December 19, 2016 at 12:34 PM any help ?? Link to comment Share on other sites More sharing options...
ahco Posted December 23, 2016 at 03:08 PM Author Report Share #601484 Posted December 23, 2016 at 03:08 PM bem como não consegui arranjar solução fui buscar por query o last id. abraço Link to comment Share on other sites More sharing options...
vikcch Posted December 24, 2016 at 09:03 AM Report Share #601492 Posted December 24, 2016 at 09:03 AM vê-lá se ajuda: http://stackoverflow.com/questions/42648/best-way-to-get-identity-of-inserted-row Link to comment Share on other sites More sharing options...
ahco Posted December 26, 2016 at 02:59 PM Author Report Share #601511 Posted December 26, 2016 at 02:59 PM Boa tarde vikcch, obrigado pelo link, isso do identity ja sei. mas como é um projecto grande e tenho que ter os datasets typed, e fazer o insert de forma automatica. vou dar o exemplo Dim imovel As DataRow imovel = DBDataSet.Tables("TBLIMO").NewRow imovel.Item("Localizacao") = LocalizacaoTextBox.Text imovel.Item("Tipologia") = ComboBox1.SelectedValue imovel.Item("IMG") = nomeimg DBDataSet.Tables("TBLIMO").Rows.Add(imovel) TableAdapterManager.UpdateAll(DBDataSet) Como pode verificar estou a fazer o insert de forma automática. apartir desta situaçao como consigo ir buscar o ultimo id. Se for de forma manual sqlcomand sei o fazer, mas o insert é tao grande tao grande nem me atrevo o fazer. Link to comment Share on other sites More sharing options...
ahco Posted January 6, 2017 at 02:38 PM Author Report Share #601858 Posted January 6, 2017 at 02:38 PM ninguem tem ideia de como se chama o ultimo registo inserido pelo dataset ?? Link to comment Share on other sites More sharing options...
_Rest_ Posted January 13, 2017 at 12:55 PM Report Share #601988 Posted January 13, 2017 at 12:55 PM (edited) Essa tabela tem algum identifier? Se tiver basta fazeres um link ao ultimo ID. Se não tiver podes sempre ir pelo ultimo index da row da tua DataTable exemplo ds.Tables("TBLIMO").Rows(ds.Tables("TBLIMO").Rows.Count - 1) Edited January 13, 2017 at 12:59 PM by _Rest_ Link to comment Share on other sites More sharing options...
ahco Posted January 16, 2017 at 03:47 PM Author Report Share #602032 Posted January 16, 2017 at 03:47 PM sim tem identificador. deixa me verificar. Obrigado Link to comment Share on other sites More sharing options...
ahco Posted February 3, 2017 at 11:57 AM Author Report Share #602310 Posted February 3, 2017 at 11:57 AM ainda nao me resolveu o assunto pena, Link to comment Share on other sites More sharing options...
_Rest_ Posted February 8, 2017 at 10:25 AM Report Share #602404 Posted February 8, 2017 at 10:25 AM Como assim? Qual é o erro? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now