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, 3718 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.)
It is very nice app, Thank you for making that.
Could you add a help doc for the app and add some SQL command so we can use it easier.
Rs
* Thankful to Allah *
Kurdy
Bro i need VB.NET cause i move state so i got nothing now forgot put it in my USP.
You can answer here or skype.
[Image: PoLcwTr.gif]
mybb_mysql_browser Update

Add to  existing form1_load keep in mind this has been tested but look like crap so by all means change the color and experiment with itt
code change the ground color and text colo of a datagrid

  DataGridView1.RowsDefaultCellStyle.BackColor = Color.Bisque
  DataGridView1.GridColor = Color.Red 
  DataGridView1.CellBorderStyle = DataGridViewCellBorderStyle.None
  DataGridView1.BackgroundColor = Color.LightGray
  DataGridView1.DefaultCellStyle.SelectionBackColor = Color.Red
  DataGridView1.DefaultCellStyle.SelectionForeColor = Color.Yellow
  DataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState  .[True]
  DataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect
  DataGridView1.AllowUserToResizeColumns = False
  DataGridView1.RowsDefaultCellStyle.BackColor = Color.Bisque
  DataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige
(07-28-2017, 04:05 AM)viruss Wrote: mybb_mysql_browser Update

Add to  existing form1_load keep in mind this has been tested but look like crap so by all means change the color and experiment with itt
code change the ground color and text colo of a datagrid

  DataGridView1.RowsDefaultCellStyle.BackColor = Color.Bisque
  DataGridView1.GridColor = Color.Red 
  DataGridView1.CellBorderStyle = DataGridViewCellBorderStyle.None
  DataGridView1.BackgroundColor = Color.LightGray
  DataGridView1.DefaultCellStyle.SelectionBackColor = Color.Red
  DataGridView1.DefaultCellStyle.SelectionForeColor = Color.Yellow
  DataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState  .[True]
  DataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect
  DataGridView1.AllowUserToResizeColumns = False
  DataGridView1.RowsDefaultCellStyle.BackColor = Color.Bisque
  DataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige


Nice work bro Smile
Rs
* Thankful to Allah *
Kurdy



Users browsing this thread: 1 Guest(s)