Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Selecting/Updating/Inserting MySQL

Hello HackForums!

I am wondering if there is any good tutorials related to using MySQL with vb.net. Now I have seen plenty of them but they use php files for login/register/etc. However I do want to use a php file to connect to my database that way it's not stored in the application. If you know any tutorials or a good way of doing this it would help a lot thank you.
In that case I would say learn PHP, understand how things work in PHP. Then learn how you can use PHP to create an API Endpoint that other devices can interact with.
tut http://www.visual-basic-tutorials.com/Tu.../code8.htm
cmd http://www.w3schools.com/sql
Connect to MySQL from .NET using PHP? Really?
Maybe you need to connect it throught a wrapper coded in C++, and this C++ wrapper calls a VB5 wrapper and this one calls another COBOL app, and this finally call another wrapper coded in Delphi...[/ironic Mode off]

You only need the MySQL ".NET conector" available from dev.MySQL (http://dev.mysql.com/downloads/connector/net/) or the super-easy alternative: use NuGet Manager and simply use:

Install-Package MySql.Data

Once you have the MySql.Data reference into your project, all the CRUD operaciones are basically the same as SqlClient:
PHP Code

<?php 
Dim sqlConnection1 
As New SqlConnection("Your Connection String")
Dim cmd As New SqlCommand
Dim reader 
As SqlDataReader

cmd
.CommandText = "SELECT * FROM Customers"
cmd.CommandType = CommandType.Text
cmd
.Connection = sqlConnection1

sqlConnection1
.Open()

reader = cmd.ExecuteReader()
' Data is accessible through the DataReader object here.

sqlConnection1.Close() 
Instead SqlConnection type you should have MySqlConnection type, instead SqlCommand you should have MySqlCommand, instead SqlDataReader you have MySqlDataReader,...
(Apr 17, 2016 12:30 PM)+Haze Wrote:  In that case I would say learn PHP, understand how things work in PHP. Then learn how you can use PHP to create an API Endpoint that other devices can interact with.

I am very familiar with PHP. This would be just a huge process to go through just to do normal sql commands. As I do not wish to spend a week on a project it would just entirely be to much. Thank you though. :)

(Apr 17, 2016 12:59 PM)Only3 Wrote:  tut http://www.visual-basic-tutorials.com/Tu.../code8.htm
cmd http://www.w3schools.com/sql

Thank you will check this out and hopefully it is what I need, Problem is that I know a good amount of vb.net and php but looking to make an sql based game. Thank you for the resources. :)

(Apr 17, 2016 01:06 PM)Zilog80 Wrote:  Connect to MySQL from .NET using PHP? Really?
Maybe you need to connect it throught a wrapper coded in C++, and this C++ wrapper calls a VB5 wrapper and this one calls another COBOL app, and this finally call another wrapper coded in Delphi...[/ironic Mode off]

You only need the MySQL ".NET conector" available from dev.MySQL (http://dev.mysql.com/downloads/connector/net/) or the super-easy alternative: use NuGet Manager and simply use:

Install-Package MySql.Data

Once you have the MySql.Data reference into your project, all the CRUD operaciones are basically the same as SqlClient:
PHP Code

<?php 
Dim sqlConnection1 
As New SqlConnection("Your Connection String")
Dim cmd As New SqlCommand
Dim reader 
As SqlDataReader

cmd
.CommandText = "SELECT * FROM Customers"
cmd.CommandType = CommandType.Text
cmd
.Connection = sqlConnection1

sqlConnection1
.Open()

reader = cmd.ExecuteReader()
' Data is accessible through the DataReader object here.

sqlConnection1.Close() 
Instead SqlConnection type you should have MySqlConnection type, instead SqlCommand you should have MySqlCommand, instead SqlDataReader you have MySqlDataReader,...

Also thank you for your response and I was thinking about going with NuGet so if in my journey I don't find what I am looking for this is most likely what I will be using.




Again, I am trying to make a game in vb.net but it needs to store data is some type of database that can't be modified, Exception would be the developer so if there is any other methods you guys know to store data like this that would be great. :)


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by FryPanSep 11, 2017 06:50 PM 2 182 Sep 11, 2017 06:50 PM
Last Post: uint32
[.NET] by GruntStylDec 6, 2016 04:45 AM 1 175 Dec 6, 2016 04:45 AM
Last Post: Rhez
[C#] by Elite Hacker 69Dec 4, 2016 08:46 PM 11 181 Dec 4, 2016 08:46 PM
Last Post: Elite Hacker 69