Connecting to MSSQL Server with VB.net is fairly easy. Just follow the steps below:
1. Create a database in MSSQL Server 2005 (I'm using MSSQL Server Express 2005).
I've created the following database structure:
Database Name: Pawnshop Table: Jewelry Fields: Id Name Type
I filled it up with the following values:
2. Create a new VB.net Project
3. Add a DataGridView to the form
4. Double Click on the Form and Replace all codes with the following (my server ip address is 192.168.2.2. Replace with your own ip address. replace the user and password accordingly):
5. Run the program
You can download the source code and database here.
Connect to the best online keno and blackjack games, and try out roulette online at CasinoBonus.org!
1. Create a database in MSSQL Server 2005 (I'm using MSSQL Server Express 2005).
I've created the following database structure:
Database Name: Pawnshop Table: Jewelry Fields: Id Name Type
I filled it up with the following values:
Id Name Type
1 Gold Necklace Necklace
2 Gold Watch Watch
3 Gold Earrings Earrings
4 Silver Bullet Bullet
5 Silver Dust Dust
6 Gold Coin Coin
7 Bronze Medal Medal
8 Bronze bracelet Bracelet
9 Aluminum Foil Foil
10 Gold Ring Ring
2. Create a new VB.net Project
3. Add a DataGridView to the form
4. Double Click on the Form and Replace all codes with the following (my server ip address is 192.168.2.2. Replace with your own ip address. replace the user and password accordingly):
Imports System.Data.SqlClient
Public Class Form1
Dim cn As New SqlConnection("Data Source=192.168.2.2\SQLEXPRESS;Initial Catalog=Pawnshop;User Id=sa;Password=password;")
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cn.Open()
Dim cmd As New SqlCommand("select * from Jewelry", cn)
Dim adp As New SqlDataAdapter(cmd)
Dim dt As New DataTable()
adp.Fill(dt)
DataGridView1.DataSource = dt
End Sub
End Class
5. Run the program
You can download the source code and database here.
Connect to the best online keno and blackjack games, and try out roulette online at CasinoBonus.org!
Comments