I have everything done, but I forgot one simple little thing, how to save the database to a textfile, I have two forms with this application, the first one has all the information in it (textboxes) and a listbox in it to see all the contacts, then the second form has all the textboxes (contact ID, First name, Last name, telephone, address, city, zip code, and email) that the user can put information in and hit add item to add it, it has a save button that will save it to the application, but I forgot to add a save button so it saves to a text file and loads from a text file, if anyone knows how to do a database could you help me out

This is my code for form1

Public Class Form1

    Private Sub ContactBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ContactBindingNavigatorSaveItem.Click
       
        First_nameTextBox.Enabled = True
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'Assignment10DataSet.contact' table. You can move, or remove it, as needed.
        Me.ContactTableAdapter.Fill(Me.Assignment10DataSet.contact)

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Form2.Show()

    End Sub

   

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Me.Validate()
        Me.ContactBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.Assignment10DataSet)
        MsgBox("Saved")

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Validate()
        Me.ContactTableAdapter.Delete(Me.First_nameTextBox.Text, Me.Last_nameTextBox.Text)

        Me.ContactTableAdapter.Fill(Me.Assignment10DataSet.contact)


        MsgBox("Deleted")
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

    End Sub
End Class

and this is for form2

Public Class Form2

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.Close()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Form1.ContactTableAdapter.Insert(Me.TextBox1.Text, Me.TextBox2.Text,
                                         Me.TextBox3.Text, Me.TextBox4.Text,
                                         Me.TextBox5.Text, Me.TextBox6.Text,
                                         Me.TextBox7.Text, Me.TextBox8.Text,
                                         Me.TextBox9.Text)

        Form1.ContactTableAdapter.Fill(Form1.Assignment10DataSet.contact)

        MsgBox("completed")

        For Each item As Control In Me.Controls
            If TypeOf item Is TextBox Then
                item.Text = String.Empty
            End If
        Next




    End Sub
End Class

If I understand you well, you would like to copy content of the dataBase to a textFile. But only the data, or th whole structure, like sql has with "Export" option?

use mysqldump...
here's the code: mysqldump.exe -h [servername] -u [username] -p [password] database name > locationofthefile\backupname.sql...try this to command dos..
hope it will help...

What its supposed to be is an address book that it should be able to read and write to a text file. It already saves everything in there, all the contact information, because everytime I open it up, all the contacts that I saved are still there, but what I would like it to do is be able to put everything that has been saved and save it to a text file (this would be a different button, then the save to listbox button), so basically you can print it, but still be able to load it up when you need to make changes to it, either add, edit, or remove something on there (this part I have all done) I hope this helps

you can backup every time you save new record to your database..yeah you are right you can make a button to dump your database...and you change the name of that sql file everytime you save every data updated from your db..I have to options for you:


1.you can use the "mysql dump statement" I had given to you to command dos......it will work..it will backup your db into a .sql file. A .sql file also refer a text file...Or its structure is same to a txt file.


2.download "MYSQL ADMINISTRATOR". This application will backup your db into a sql file(txt file). Just make a button to call that application. Write this command to that button afterwards: Process.Start("LocationOfTheApplication")..After that click the button and it will show up..

Hope it will help...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.