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


Advanced Search

Re: Import from DataGridView to Database
Posted by: Shay _Fox ()
Date: February 08, 2016 01:55PM

World Eyeglasses Wrote:
-------------------------------------------------------
> 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

Thanks for the information sharing.

Options: ReplyQuote


Subject Views Written By Posted
Import from DataGridView to Database 1081 Daniel Márquez 11/23/2015 05:57AM
Re: Import from DataGridView to Database 619 Javier Treviño 11/23/2015 12:50PM
Re: Import from DataGridView to Database 581 Daniel Márquez 11/23/2015 02:46PM
Re: Import from DataGridView to Database 574 World Eyeglasses 11/27/2015 11:11PM
Re: Import from DataGridView to Database 492 Daniel Márquez 11/27/2015 11:19PM
Re: Import from DataGridView to Database 490 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.