Jump to content

[VB.NET] Guardar dados de um Array list


martim07

Recommended Posts

Boas,

eu tenho um arraylist que contem  3 valores (int,string, int).

Agora eu quero guardar esses valores na minha base de dados (sql server 2005) através de DataSets, TableAdapaters, etc.. mas eu n sei como é k s faz. Já andei á procura na net mas n consigo encontrar nada.

S alguem me arranjar um exemplo agradecia.

Cumprimentos  😉

Link to comment
Share on other sites

Public Class Pessoa
  Private nome As String
  Private morada As String
  

  Public Property nome() As String
    Get
      Return Me.nome
    End Get
    Set(ByVal Value As String)
      Me.nome = Value
    End Set
  End Property

  Public Property morada() As String
    Get
      Return Me.morada
    End Get
    Set(ByVal Value As String)
      Me.morada = Value
    End Set
  End Property




Link to comment
Share on other sites

agora para adicionares la valores tem de ser assim

Public Class Pessoas

 'ArrayList para armazenamento das PESSOAS
 Private array As New ArrayList

 Sub New()
   

  'inserir uma nova pessoa 
  
     Dim ObjPessoa As New Pessoa
 
     ObjPessoa.Nome = textbox1.text
     ObjPessoa.Morada = textbox2.text
     
 
     Me.array.Add(ObjPessoa)
   Next
 End Sub

akii no array na posicao(0) tens o nome e a morada de uma pessoa..se kiseres adicionar outra pessoa  ele mete na posicao(1) 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.