Reputation: 1808
I've searched around and haven't been able to find anything along the lines of doing this.
Upvotes: 1
Views: 38515
Reputation: 651
Install MySQL connector for .NET, and APACHE, also install XAMPP so you could use phpMyAdmin
Upvotes: 0
Reputation: 23
I use C#:
const String ConnectionString = "Driver={MySQL ODBC 5.1 Driver};Server=localhost;Port=3306;Database=test;User=root;Password=;Option=3;";
OdbcConnection conn = new OdbcConnection(ConnectionString);
conn.Open();
OdbcCommand command = new OdbcCommand();
command.CommandType = CommandType.StoredProcedure;
command.Connection = conn;
command.CommandText = "insert into search (tempsearchKey, state, suburb) values ('" + tempsearchKey+"','"+state+"','"+suburb+"')";
command.ExecuteNonQuery();
command.Cancel();
install odbc driver from mysql website
and convert this to VB.NET,
Maybe this link could help:
http://dev.mysql.com/tech-resources/articles/ebonat-load-and-search-mysql-data-using-vbnet-2005.html
Upvotes: 0
Reputation: 21
Imports System.Data.SqlClient
Imports MySql.Data.MySqlClient
Public Class LoginForm1
Dim MySQLConnection As MySqlConnection
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.Close()
End Sub
Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.Close()
End Sub
Private Sub Cancel_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
End
End Sub
Private Sub OK_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
MySQLConnection = New MySqlConnection
MySQLConnection.ConnectionString = "server=db4free.net;Port=3306; User ID=db4freeusername; password=db4freepassword; database=nameofyourdatabase"
MySQLConnection.Open()
Dim MyAdapter As New MySqlDataAdapter
Dim SqlQuary = "SELECT * From nameofthetable 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
If Mydata.HasRows = 0 Then
MsgBox("Error During Login:Please Enter Valid Data")
Else
Form1.Show()
Me.Hide()
End If
End Sub
End Class
Upvotes: 2
Reputation: 668
First of all you need to install MySQL connector for .NET.
Imports MySql.Data.MySqlClient
Dim myConnection As MySqlConnection = New MySqlConnection()
Dim myConnectionString As String = "Server=SERVERNAME;Database=DATABASE;Uid=root;Pwd=password;"
myConnection.ConnectionString = myConnectionString
myConnection.Open()
//execute queries, etc
myConnection.Close()
Upvotes: 1
Reputation: 415735
You need to install Connector/Net, which will give you a full ADO.Net provider for MySql you can use. Be warned that this is GPL software, meaning if you distribute it as part of a commercial product you must also distribute your source code. It's an open legal question, but last I heard most web sites are okay with this, because you are not distributing your server code. Desktop apps may have an issue, though.
Upvotes: 2