|
-
Jul 20th, 2011, 04:40 PM
#1
Thread Starter
New Member
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
-
Jul 21st, 2011, 08:36 AM
#2
New Member
Re: Mysql without install?
you should install SQL server on your clients computer. it will solve your problem.
-
Jul 21st, 2011, 08:53 AM
#3
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
-
Jul 21st, 2011, 09:14 AM
#4
Thread Starter
New Member
Re: Mysql without install?
So if I can't program a workaround, do you know any alternative methods to achieving an online database?
-
Jul 21st, 2011, 10:39 AM
#5
Re: Mysql without install?
 Originally Posted by techgnome
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'
-
Jul 21st, 2011, 11:20 AM
#6
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|