3 Replies - 15446 Views - Last Post: 12 March 2009 - 09:30 AM Rate Topic: -----

#1 mutazit  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 2
  • Joined: 12-March 09

save and retrieve image using vb 6 and sql server 2005

Posted 12 March 2009 - 04:19 AM

please help me i am use visual basic language and sql server 2005 database i need code how to save picture and retrive picture
i create form
3 textbox
1 image
4 lable
Is This A Good Question/Topic? 1

Replies To: save and retrieve image using vb 6 and sql server 2005

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6064
  • View blog
  • Posts: 23,519
  • Joined: 23-August 08

Re: save and retrieve image using vb 6 and sql server 2005

Posted 12 March 2009 - 04:43 AM

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Post your code like this: :code:

Thanks.
Was This Post Helpful? 0
  • +
  • -

#3 mutazit  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 2
  • Joined: 12-March 09

Re: save and retrieve image using vb 6 and sql server 2005

Posted 12 March 2009 - 05:24 AM

Dim rs As ADODB.Recordset
Dim cn As ADODB.Connection
Dim strStream As ADODB.Stream

Private Sub cmdLoad_Click()
	If Not LoadPictureFromDB(rs) Then
		MsgBox "Invalid Data Or No Picture In DB"
	End If
End Sub

Private Sub cmdSelectSave_Click()
	'Open Dialog Box
	With dlgDialog
		.DialogTitle = "Open Image File...."
		.Filter = "Image Files (*.gif; *.bmp)| *.gif;*.bmp"
		.CancelError = True
procReOpen:
		 .ShowOpen
		 
		If .FileName = "" Then
			MsgBox "Invalid filename or file not found.", _
				vbOKOnly + vbExclamation, "Oops!"
			GoTo procReOpen
		Else
			If Not SavePictureToDB(rs, .FileName) Then
				MsgBox "Save was unsuccessful :(", vbOKOnly + _
						vbExclamation, "Oops!"
				Exit Sub
			End If
		End If
			
	End With
End Sub



Was This Post Helpful? 1
  • +
  • -

#4 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6064
  • View blog
  • Posts: 23,519
  • Joined: 23-August 08

Re: save and retrieve image using vb 6 and sql server 2005

Posted 12 March 2009 - 09:30 AM

Apparently this is a common homework question. If you Google the first line of the cmdLoad_Click() subroutine, you'll find answers.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1