Advertisement
Guest User

Untitled

a guest
Jul 1st, 2013
592
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2.  
  3. Private Sub cmdSave_Click()
  4.     On Error GoTo cmdSave_Error
  5.     With CommonDialog1
  6.         .CancelError = True
  7.         .Filter = "Image Files (*.gif; *.bmp; *.jpg)| *.gif;*.bmp;*.jpg"
  8.         .ShowOpen
  9.     End With
  10.    
  11.     AddImageToDB CommonDialog1.FileName, 2, "File added to database"
  12.    
  13. Exit Sub
  14. cmdSave_Error:
  15. End Sub
  16.  
  17. Private Sub cmdView_Click()
  18.  
  19. Dim strTempPath As String
  20. Dim strTempName As String
  21. Dim strTempFile As String
  22. Dim blnShow As Boolean
  23.  
  24.     'Create a temp file name
  25.    strTempPath = IIf(Right(App.Path, 1) = "\", App.Path, App.Path & "\")
  26.     strTempName = Format(Now, "MMDDYYHHNNSS") & ".bmp"
  27.     strTempFile = strTempPath & strTempName
  28.    
  29.     blnShow = ViewFromDB(2, strTempFile)
  30.    
  31.     If blnShow Then
  32.         Picture1.Picture = LoadPicture(strTempFile)
  33.         DoEvents
  34.         Kill (strTempFile)
  35.     End If
  36. End Sub
  37.  
  38. Private Sub Form_Load()
  39.     'Set the connectionstring to your database
  40.    strConnString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=bscit;Data Source=PC-1\SQLEXPRESS"
  41. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement