Discord Server Red Security Twitter Donation to Red Security Red Security Youtube Channel Red Security Tumblr Profile
Login or Register to Hide ads and Accessing all features on the forum

mybb_mysql_browser

4 Replies, 3721 Views

here is my mybb_mysql_query browser
code:

whats needed
1 textbox
1 gridview
1 button



Imports MySql.Data.MySqlClient
Imports System
Imports System.Security.Cryptography
Imports System.Text

Public Class Form1

    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
        Dim g As Graphics = e.Graphics
        Dim pen As New Pen(Color.Red, 4.0)

        Dim txtBox As Control
        For Each txtBox In Me.Controls
            If TypeOf (txtBox) Is TextBox Then
                g.DrawRectangle(pen, New Rectangle(txtBox.Location, _
                txtBox.Size))
            End If
        Next
        pen.Dispose()


      


    End Sub



    'Represents an SQL statement or stored procedure to execute against a data source.
    Dim cmd As New MySqlCommand
    Dim da As New MySqlDataAdapter
    Public total As Integer
    Dim publictable As New DataTable
    'declare conn as connection and it will now a new connection because 
    'it is equal to Getconnection Function
    Dim con As MySqlConnection = jokenconn()

    Public Function jokenconn() As MySqlConnection
        Return New MySqlConnection("server=server_ipaddress;user id=usernamehere; password=your-password-here;database=dbname")
    End Function
   
    


   
    
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
     

        Dim publictable As New DataTable
        Dim sql As String
        sql = TextBox1.Text
        Try
            'bind the connection and query
            With cmd
                .Connection = con
                .CommandText = sql
            End With
            'Gets or sets a Transact-SQL statement or stored procedure used to select records in the data source.
            da.SelectCommand = cmd
            da.Fill(publictable)
            'get the datasource from publictable and passed to datagridview
            DataGridView1.DataSource = publictable

            'dispose the dataadapter
            da.Dispose()
        Catch ex As Exception

            MsgBox(ex.Message)

        End Try
        con.Close()
        da.Dispose()

    End Sub
    Public Overrides Property AutoSize As Boolean
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        TextBox1.BorderStyle = BorderStyle.None
        DataGridView1.BorderStyle = BorderStyle.None
        TextBox1.Text = "select * from mybb_users"
        Button1.PerformClick()
        Me.WindowState = FormWindowState.Maximized
        DataGridView1.GridColor = Color.BlueViolet
        TextBox1.AutoSize = True
    End Sub


End Class

sql browser images:

[Image: querrybrowser.png]

[Image: querytables.png]
(This post was last modified: 07-22-2017, 04:06 AM by viruss.)

Messages In This Thread
mybb_mysql_browser - by viruss - 07-22-2017, 04:04 AM
RE: mybb_mysql_browser - by Mr.Kurd - 07-22-2017, 07:05 AM
RE: mybb_mysql_browser - by DarkCode - 07-22-2017, 12:33 PM
RE: mybb_mysql_browser - by viruss - 07-28-2017, 04:05 AM
RE: mybb_mysql_browser - by Mr.Kurd - 07-28-2017, 09:49 PM



Users browsing this thread: 1 Guest(s)