Question How to store pictures in sql

clzanas

Member
Joined
Jul 15, 2009
Messages
16
Programming Experience
Beginner
Hi guys,

As i am new to visual basic and sql database 2005, I am wondering how to go about storing pictures in the sql database with a few lines of code. Because i wanted to create like after u key in the handphone number and press the search button, the owner's unit will come out in a picture form, and the picture is stored inside the sql database. The user will then be able to update the picture if there is any change in owner of the house, in case they want to change the main door gate.

Hmm... wondering if any one is willing to help me? The search part i've already done except for the picture. It is an enhancement for my project.lol.

The below is my code for the search part.


conn.Open()
inc = 0
Dim loginCommand As SqlCommand = conn.CreateCommand()
loginCommand.CommandText = "SELECT * FROM ABCcondo WHERE HandPhoneNumber = '" & TextBox1.Text & "'"
Dim dr As SqlDataReader = loginCommand.ExecuteReader

If dr.Read Then
Dim i As Integer

MaxRows = ds.Tables("ABCcondo").Rows.Count
MaxRows = MaxRows - 1


Dim numbers() As Integer

Dim EndAt As Integer


inc = 0
EndAt = ds.Tables("ABCcondo").Rows(MaxRows).Item(0)

ReDim numbers(EndAt)

For i = inc To EndAt - 1

Dim a As String
a = TextBox1.Text


If String.Equals(a, ds.Tables("ABCcondo").Rows(i).Item(5)) Then

TextBox6.Text = ds.Tables("ABCcondo").Rows(i).Item(1)
TextBox5.Text = ds.Tables("ABCcondo").Rows(i).Item(2)
TextBox4.Text = ds.Tables("ABCcondo").Rows(i).Item(3)
Button3.Text = ds.Tables("ABCcondo").Rows(i).Item(4)
TextBox3.Text = ds.Tables("ABCcondo").Rows(i).Item(5)

End If


Next i
End If

dr.Close()
conn.Close()
 

Latest posts

Back
Top