Private Sub LVlist_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LVlist.SelectedIndexChanged
If LVlist.SelectedItems.Count > 0 Then
With LVlist.SelectedItems(0)
VarIdentifier = .SubItems(0).Text
lblname.Text = .SubItems(0).Text
End With
pix()
End If
end sub
Sub pix()
sql = "select pic from tbldishlist where nod = '" & lblname.Text & "'"
Dim acscmd = New OleDb.OleDbCommand(sql, Con)
acsdr = acscmd.ExecuteReader()
acsdr.Read()
If acsdr!pic <> "" Then
PictureBox1.Load(imgPath & acsdr!pic)
Else : PictureBox1.Load(imgPath & "add_user.jpg")
End If
acsdr.Close()
End Sub
jez9 5 Junior Poster
Recommended Answers
Jump to PostI suggest the following method to display a picture in a PictureBox from a file
Dim fs As New System.IO.FileStream(FileList(indx), IO.FileMode.Open, IO.FileAccess.Read) pbxPicture.Image = System.Drawing.Image.FromStream(fs)
If you load the picture directly (without using a FileStream) you end up locking the file. Using a FileStream releases the …
Jump to PostI don't know what kind of database you are using. If it is MS SQL then you can use SQLDB as follows to retrieve and display the image
Imports System.Data Imports System.Data.SqlClient Imports System.IO Imports System.Drawing.Imaging Private Sub btnRetrieve_Click(sender As System.Object, e As System.EventArgs) Handles btnRetrieve.Click Dim …
Jump to PostHere is the OleDB version
Private Sub btnOleDb_Click(sender As System.Object, e As System.EventArgs) Handles btnOleDb.Click Dim con As New OleDbConnection("Provider=SQLNCLI10;Server=.\SQLEXPRESS;Database=mydb;Trusted_Connection=Yes;Connect Timeout=15;") Dim cmd As New OleDbCommand("SELECT picdata FROM test WHERE picname = '" & imgname & "'", con) con.Open() Dim rdr As OleDbDataReader = cmd.ExecuteReader If rdr.Read …
Jump to PostIf you are using MS SQL as your database then you should be using SQLDB rather than OLEDB. Both are built on top of ADODB (which you could also use), however, SQLDB is optimized for MS SQL. OLEDB is used for other data sources. In terms of complexity I don't …
Jump to PostNo difference. SQLDB and OLEDB are merely interfaces. The actual data storage is a function of the underlying database. Consider the database like a huge parking lot and SQLDB and OLEDB the highway you use to get vehicles to/from the parking lot. For small to medium databases (I can't actually …
All 20 Replies
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
jez9 5 Junior Poster
Mr.M 89 Future Programmers
jez9 5 Junior Poster
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
jez9 5 Junior Poster
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
Santanu.Das commented: Mind-blowing +5
jez9 5 Junior Poster
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
jez9 5 Junior Poster
jez9 5 Junior Poster
jez9 5 Junior Poster
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
jez9 5 Junior Poster
jez9 5 Junior Poster
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
jez9 5 Junior Poster
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
jez9 5 Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.