Tampilkan postingan dengan label connecting. Tampilkan semua postingan
Tampilkan postingan dengan label connecting. Tampilkan semua postingan

Rabu, 09 Maret 2016

Guidlines before Connecting External Device

,
Read the following guidelines before connecting external device.

1. Make sure your devices are compliant with the connectors you wish to connect.

2. Before installing the devices, be sure to turn off the devices and your computer.
Unplug the power cord from the power outlet to prevent damge to the devices.

3. After installing the device and before turning on the computer, make sure the device cable has been securely attached to the connector on the motherboard.
Read more

Rabu, 29 Januari 2014

HRMS Connecting to database

,
Run the Visual Studio (VB.Net software), create new project and name it "HRMS". We need first is to add references for us to connect to our database, for adding references;


  • Into your main menu, go to "Project" and select "Add Reference"
  • add reference dialog box will appear, then go to ".NET" tab menu
  • inside your .Net tab, select "MySql.Data"
  • then press OK.
after adding references lets add module where we can input the code. To add "Module", go to the upper part of your visual studio. see image below.

Figure 1.4















adding Module:

  • right click on HRMS
  • select Add
  • click New Item, dialog box will appear
  • select Module
  • change the name of your module, by default (Module1.vb)
  • then click OK
it depends on you if you wanna change the name... i put (conn.vb) in my module. after clicking OK check if your module is added on the upper right part of your visual studio.

double click your module and lets start our code.

first we need to import our mysql data. this is how to import it. On the upper part of your code insert this code;


Imports MySql.Data
Imports MySql.Data.MySqlClient

we need to add 5 Public declaration, insert this code inside your module code;


 Public conSql As MySqlConnection
 Public str As String = Nothing
 Public cmd As MySqlCommand
 Public dr As MySqlDataReader
 Public da As MySqlDataAdapter

note: the other 4 public declaration will be use later in our system.

create a Public Sub Function below your public declaration.

Public Sub SQLconn()
End Sub

inside your function we are going to connect are database using then Try Catch method. insert this code inside you SQLconn() function.

Try
Catch ex as Exception
End Try

paste this code at the middle of your Try Catch method;


conSql = New MySqlConnection("server=localhost;database=hrms;username=root")

conSql.Open()
 MsgBox("Successfully connected!", MsgBoxStyle.Information)


conSql - connection into your database

server: localhost (default server name)
database: hrms
username: root (default username)

at the middle of your Catch and End Try paste this msgbox;

MsgBox("Cannot connect to database", MsgBoxStyle.Information)

go back into your form, and double click the form, inside your form load paste the name of your function;

SQLconn()

if all done, try to run your program if you sucessfully connected into your database.


Read more
 

Computer Information Copyright © 2016-2022 -- Powered by Blogger