Imports MySql
Imports MySql.Data
Imports MySql.Data.MySqlClient
Public Class MySQL
' Class to connect and start mysql queries
'###########################################
' Attributes
Private dbConnection As MySqlConnection
Private serverFeedback As DataTable = Nothing
Private connectionString As String = "server=;uid=;pwd=;database=;"
Public query As String
Public parameters As New List(Of String)
''' <summary>
''' Creates a mysql instance and connection through official mysql lib
''' </summary>
Sub New()
dbConnection = New MySqlConnection
dbConnection.ConnectionString = connectionString
Try
dbConnection.Open()
Catch ex As Exception
MessageBox.Show("Error", "MySQL Connection failed!" + vbNewLine + ex.Message, MessageBoxButtons.OK, icon:=MessageBoxIcon.Error)
End Try
End Sub
''' <summary>
''' Executes query and saves the feedback in *serverFeedback*
''' </summary>
Public Function executeQuery() As Boolean
Dim cmd As New MySqlCommand(query, dbConnection)
'Parameter binding
Dim i As Integer = 0
For Each parameter As String In Me.parameters
cmd.Parameters.AddWithValue(i.ToString(), parameter)
i += 1
Next
'Execute Query
Try
'Get and write response
Dim da As New MySqlDataAdapter(cmd)
Dim ds As New DataSet()
da.Fill(ds, 0)
If ds.Tables.Count > 0 Then
Dim dt As DataTable = ds.Tables(0)
serverFeedback = dt
Else
serverFeedback = Nothing
End If
Return True
Catch ex As Exception
MessageBox.Show(String.Format("MySQL Query Execute failed!{0}{1}", vbNewLine, ex.Message), "Error", MessageBoxButtons.OK, icon:=MessageBoxIcon.Error)
Return False
End Try
End Function
''' <summary>
''' Attribute return function
''' </summary>
''' <returns>Server feedback as a DataTable</returns>
Public Function getServerReturn()
Return serverFeedback
End Function
''' <summary>
''' Closes MySQL Connection. Object not usable after calling this!
''' </summary>
Public Sub closeConnection()
dbConnection.Close()
Me.Finalize()
End Sub
End Class
I just have checked the C# code but I assume the VB.Net may work the same. So here is some feedback about several issues I noticed by quickly scanning your code:
1: In sense to use this class as a MySQL wrapper you should be able to pass the connection data through the constructor and building the connection string dynamically instead of defining them during compile time and using the pre defined connection string.
2: Do not catch an exception and show a message box with the error in a class you may want to spread. In general, this type of error handling belongs to the developer who wants to use your lib.
3: Same for the query as for the constructor. Pass the query as parameter so it can be used for any query.
4: Instead of the closeConnection you should implement interface.
I just have checked the C# code but I assume the VB.Net may work the same. So here is some feedback about several issues I noticed by quickly scanning your code:
1: In sense to use this class as a MySQL wrapper you should be able to pass the connection data through the constructor and building the connection string dynamically instead of defining them during compile time and using the pre defined connection string.
2: Do not catch an exception and show a message box with the error in a class you may want to spread. In general, this type of error handling belongs to the developer who wants to use your lib.
3: Same for the query as for the constructor. Pass the query as parameter so it can be used for any query.
4: Instead of the closeConnection you should implement interface.
Ye thanks, that is actually an old version. handling exceptions and printing them is pretty bad i know, but it was for testing purporse only xd. thanks for feedback!
This is fairly pointless/useless, to be honest. Your class does not offer any real useful features or expand off the already available features of the MySQL connector itself. There are several errors with your code as well, such as returning a value in a void function.
Mysql funktioniert nicht.. service mysql status mysql does not exist in /etc/rc.d 07/09/2015 - Metin2 Private Server - 8 Replies Hey,
mein Mysql Server funktíoniert von jetzt auf gleich nicht mehr..
Kam aus dem Freibad und alles war down..
Wenn ich den Mysql Server starten will sagt er mir:
" service mysql status
mysql does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d) "
Und wenn ich meinen Metin Server starte "cant connect to 127.0.0.1" weil der Mysql Server down ist..
Security vulnerability in MySQL/MariaDB sql/password.c 06/15/2012 - Metin2 PServer Guides & Strategies - 10 Replies Something very important for all
that article is not mine i am just sharing information
"Hi
We have recently found a serious security bug in MariaDB and MySQL.
So, here, we'd like to let you know about what the issue and its impact
is. At the end you can find a patch, in case you need to patch an older
unsuported MySQL version.
setup Net microsoft net Framework sp 3.5 sp1 log all setup Net microsoft net Framewo 11/17/2011 - Rappelz - 0 Replies setup Net microsoft net Framework sp 3.5 sp1 log all
setup Net microsoft net Framework sp 3.5 sp1 log all some proplem
this ):
here
........
http://www.elitepvpers.com/forum/rappelz/1542117- help-decrypt-client-3.html#post13918381
help @@ PLZ ):