MySQL Forums
Forum List  »  MySQL for Visual Studio

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
1151
November 23, 2015 05:57AM
Re: Import from DataGridView to Database
566
February 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.