Monday, March 17, 2014

MySQL VB.NET Tutorial 6 : Insert/Save data to database






Imports MySql.Data.MySqlClient
Public Class Form2
    Dim MysqlConn As MySqlConnection
    Dim COMMAND As MySqlCommand
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Form1.Show()
        Me.Hide()

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        MysqlConn = New MySqlConnection
        MysqlConn.ConnectionString =
       "server=localhost;userid=root;password=root;database=database"
        Dim READER As MySqlDataReader


        Try
            MysqlConn.Open()
            Dim Query As String
            Query = "insert into database.edata (eid,name,surname,age) values ('" & TextBox_Eid.Text & "','" & TextBox_Name.Text & "','" & TextBox_SName.Text & "','" & TextBox_Age.Text & "')"
            COMMAND = New MySqlCommand(Query, MysqlConn)
            READER = COMMAND.ExecuteReader

            MessageBox.Show("Data Saved")
            MysqlConn.Close()

        Catch ex As MySqlException
            MessageBox.Show(ex.Message)
        Finally
            MysqlConn.Dispose()

        End Try
    End Sub
End Class


















------------------------------------------------------------------

How to: Insert New Records into a Database

Database Access with Visual VB.NET.NET

sql server - Insert Data into database in VB.NET

How to insert Data to Ms SQL server 2008 using VB.NET.net

.net - VB.NET insert data into SQL table

Using Visual VB.NET and SQL cannot insert data into table..‎

VB.NET import data from text file into sql databse line by line‎

store xml in SQL Server 2008 from VB.NET‎

Using SQL in VB.NET - Cannot insert data into SQL table

visual VB.NET - Could not Insert the data using V VB.NET in MYSQl

Add, save & retrieve data in SQL

insert data in sql 2005 from excel file through VB.NET asp.net‎

insert data into SQL table from pre filled boxes in VB.NET 4.0‎

insert into database unsing ado.net and VB.NET Visual Basic

Insert DateTime into SQL Server using VB.NET Visual Basic

Searches related to VB.NET insert data into sql Visual Basic

VB.NET insert data into sql table Visual Basic

VB.NET insert data into sql server Visual Basic

inserting data into sql table Visual Basic

insert query  VB.NET

sql insert statement from another table
IT Certification Category (English)640x480

Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com


Top Online Courses From ProgrammingKnowledge

Python Course http://bit.ly/2vsuMaS
Java Coursehttp://bit.ly/2GEfQMf
Bash Coursehttp://bit.ly/2DBVF0C
Linux Coursehttp://bit.ly/2IXuil0
C Course http://bit.ly/2GQCiD1
C++ Coursehttp://bit.ly/2V4oEVJ
PHP Coursehttp://bit.ly/2XP71WH
Android Coursehttp://bit.ly/2UHih5H
C# Coursehttp://bit.ly/2Vr7HEl
JavaFx Coursehttp://bit.ly/2XMvZWA
NodeJs Coursehttp://bit.ly/2GPg7gA
Jenkins Course http://bit.ly/2Wd4l4W
Scala Coursehttp://bit.ly/2PysyA4
Bootstrap Coursehttp://bit.ly/2DFQ2yC
MongoDB Coursehttp://bit.ly/2LaCJfP
QT C++ GUI Coursehttp://bit.ly/2vwqHSZ