Results 1 to 6 of 6

Thread: Mysql without install?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2011
    Posts
    2

    Mysql without install?

    ok, so i made a login for a program I wrote. The program was written in vb 2008 express edition. It uses a MySql connector to connect to a database and confirm the username and password.

    Here's the source:
    Code:
    Imports System.Data.SqlClient
    Imports MySql.Data.MySqlClient
    Public Class Login
        Dim mysqlconnection As MySqlConnection
    
        Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
    
      'Retrieves online database
      TextBox1.Text = "Status: Verifiying"
      mysqlconnection = New MySqlConnection
      mysqlconnection.ConnectionString="server=db4free.net;Port=3306; user id=<username>; password=<password>; database=<database>"
      mysqlconnection.Open()
    
      Dim myadapter As New MySqlDataAdapter
      Dim sqlquary = "SELECT * From Users WHERE Username='" & UsernameTextBox.Text & "' AND Password='" & PasswordTextBox.Text & "';"
      Dim command As New MySqlCommand
      command.Connection = mysqlconnection
      command.CommandText = sqlquary
      myadapter.SelectCommand = command
      Dim mydata As MySqlDataReader
      mydata = command.ExecuteReader
    
      'Verification
      If mydata.HasRows = 0 Then
        MsgBox("Incorrect Login: Access Denied", MsgBoxStyle.Critical, "Access Denied")
        UsernameTextBox.Text = ""
        PasswordTextBox.Text = ""
        TextBox1.Text = "Status: Failed"
      Else
        MsgBox("Successful Login: Access Granted", vbInformation, "Access Granted")
        Form1.Show()
        Me.Close()
      End If
        End Sub
    
        Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
      Me.Close()
        End Sub
        Private Sub Passwordtextbox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles PasswordTextBox.KeyPress
    
      'Prevents sql injection
      If e.KeyChar = "=" Then
        MsgBox("Error: sql Injection detected, shutting down.", MsgBoxStyle.Critical, "Hacker Detected!")
        End
      ElseIf e.KeyChar = "-" Then
        MsgBox("Error: sql Injection detected, shutting down.", MsgBoxStyle.Critical, "Hacker Detected!")
        End
      ElseIf e.KeyChar = "'" Then
        MsgBox("Error: sql Injection detected, shutting down.", MsgBoxStyle.Critical, "Hacker Detected!")
        End
      Else
      End If
        End Sub
    End Class
    Here's the problem, it works fine on mine, but whenever it's given to someone that doesn't have the mysql connector installed, it won't run correctly, and crashes. I've tried just updating the clients .net framework, but it simply won't work. Is there any way I can make my code so it will still be compatible with computers without the mysql connector? If not, then are there any alternative methods to achieving an online login(with a link please)?
    >>Link<< to the connector

  2. #2
    New Member
    Join Date
    Jul 2011
    Posts
    3

    Re: Mysql without install?

    you should install SQL server on your clients computer. it will solve your problem.

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Mysql without install?

    installing SQL Server isn't going to solve anything.

    Including the mySQLConnector as a prerequisite in the install, or including the connector install in your install will.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2011
    Posts
    2

    Re: Mysql without install?

    So if I can't program a workaround, do you know any alternative methods to achieving an online database?

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Mysql without install?

    Quote Originally Posted by techgnome View Post
    Including the mySQLConnector as a prerequisite in the install, or including the connector install in your install will.
    This sounds like a reasonable 'alternative method'

  6. #6
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Mysql without install?

    Fooz - let me ask you something: if I buy a car, and give it to my wife, is there a way to make it so that I don't have to put gas in it for her to use it?

    In short that's what you're asking... you want to use something with out using it. The gas (connector) is what makes the car (database) usable. With out it (either the gas or the connector) you can use it (the car or the database).

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width