MySQL Forums :: MySQL for Visual Studio :: Import from DataGridView to Database


Advanced Search

Re: Import from DataGridView to Database
Posted by: World Eyeglasses ()
Date: November 27, 2015 11:11PM

Imports MySql.Data.MySqlClient

Private Sub showdata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles showdata.Click

Dim uspatserver As String = "server = localhost; user id = ****; password = ****; database = us_pat"
Dim uspatconnection As MySqlConnection = New MySqlConnection

datagrid.Columns.Clear()


Dim cmd As MySqlCommand = New MySqlCommand
Dim stm As String

If uspatconnection.State = ConnectionState.Closed Then
uspatconnection.Open()
End If

stm = "SELECT * FROM clinicalinfo"

cmd.CommandType = CommandType.Text
cmd.CommandText = stm
cmd.Connection = uspatconnection

Dim dt As New DataTable
dt.Load(cmd.ExecuteReader)

With datagrid
.AutoGenerateColumns = True
.DataSource = dt
End With


cmd.Dispose()
cmd = Nothing
uspatconnection.Close()
uspatconnection.Dispose()

End Sub

Options: ReplyQuote


Subject Views Written By Posted
Import from DataGridView to Database 1079 Daniel Márquez 11/23/2015 05:57AM
Re: Import from DataGridView to Database 616 Javier Treviño 11/23/2015 12:50PM
Re: Import from DataGridView to Database 579 Daniel Márquez 11/23/2015 02:46PM
Re: Import from DataGridView to Database 571 World Eyeglasses 11/27/2015 11:11PM
Re: Import from DataGridView to Database 491 Daniel Márquez 11/27/2015 11:19PM
Re: Import from DataGridView to Database 488 Shay _Fox 02/08/2016 01:55PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.