|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Want a new Job?
Chapters
Services
Feature Zones
|
Note: This is an unedited contribution. If this article is inappropriate,
needs attention or copies someone else's work without reference then please
Report This Article
IntroductionI'm currently developing an inventory management system which caters to
multiple warehouses. I will share to you some tips and tricks in the
development of this program. The system is somehow still under
development. Using the codeTo be able to create this program you must have basic knowledge concerning mySQL 5.0 as well as vb.net. 4. Change the values in your mySQL database settings. The purpose of changing the setting is that if the mySQL database settings will change e.g. the server was migrated, you can furthermore easily change server settings and you dont have to rebuild the project. 5. Add Module in your project and name it as mdlDataConn6. Paste the follwing code in your module. Imports MySql.Data.MySqlClient
Module mdlDataConn
Public conn As New MySqlConnection
Public Sub ConnectDatabase()
Try
If conn.State = ConnectionState.Closed Then
conn.ConnectionString = "DATABASE=" & My.Settings.myDB & ";" _
& "SERVER=" & My.Settings.myServer & ";user id=" & My.Settings.myUsername _
& ";password=" & My.Settings.myPassword &
";port=" & My.Settings.myPort & ";charset=utf8"
conn.Open()
End If
Catch myerror As Exception
MessageBox.Show("Error Connecting to the database", "Error Database
Server", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End
End Try
End Sub
Public Sub DisconnectDatabase()
Try
conn.Close()
Catch myerror As MySql.Data.MySqlClient.MySqlException
End Try
End Sub
End Module
'To connect to mySQL Database just call.
ConnectDatabase
'To close the mySQL Database
DisconnectDatabase
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||