[vb2012] - Work with databases

Discussion in 'Programming' started by t3cho, Mar 26, 2014.

  1. #1
    Hello

    Im working on simple project to figure out how does databases work. I want to start by simple adding a new record in database using my form.


    + Create database "users.accdb."
    + Create Form in vB
    + Connect database to form.

    Screenshot
    [​IMG]

    Now i want when i fill the fields Name,Username,Password,Age and click on Register i want to add all those records to my database, so the next time when i open the database i have the records saved.

    Im kinda bad with English so if you don't understand me ask me ...

    Have a nice day


    After few hours searching i found solution :
     
    Last edited: Mar 26, 2014
    t3cho, Mar 26, 2014 IP
  2. t3cho

    t3cho Active Member

    Messages:
    45
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    65
    #2
    Edit:

    How can i check if some record exist in database ? ..
    Im making a simple Login Form connected to database, So i have database users and now i want to compare if username.text and password.text exist in my database ? .
    I know basics about sql queries (Select * From ....Where ...) if that can help me ..

    I need your help or tutorial how to do this only. NOT tutorial about milion other things which i don't need to learn now .

    Code Form2
    Public Class Form2
    
        Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            TableUsersBindingSource.AddNew()
    
        End Sub
    
        Private Sub bDona_Click(sender As Object, e As EventArgs) Handles bDona.Click
    
            If (rName.Text = "" Or rUsername.Text = "" Or rpw.Text = "" Or rpw2.Text = "" Or rAge.Text = "") Then
                MsgBox("Molimo popunite sva polja", MsgBoxStyle.Critical)
            Else
                TableUsersBindingSource.EndEdit()
                TableUsersTableAdapter.Update(UserssDataSet.tableUsers)
                MsgBox("Registracija uspjesna", MsgBoxStyle.Information)
                Me.Hide()
            End If
    
    
    
        End Sub
    
    
        Private Sub rAge_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles rAge.Validating
            If Not IsNumeric(rAge.Text) Then
                MsgBox(" Unesite brojacanu vrijednost za godine !", MsgBoxStyle.Critical)
            End If
        End Sub
    End Class
    Code (markup):
    [​IMG]
     
    t3cho, Mar 27, 2014 IP