2009-11-08 96 views
0

我需要從員工數據庫中讀取記錄並顯示選定的項目(不是在GridView中) - 除了存儲在varbinary(max)中的圖像外,這很好。我需要逐步完成記錄 - 向前和向後。有一些沒有圖像的記錄。 我在理解每個記錄使用該數據集的轉換方法時遇到問題。Varbinary(max)圖像Visual Studio 2008

我正在使用visual studio 2008和thryng在Windows窗體應用程序中顯示記錄。

幫助將不勝感激。

下面是我的一些代碼:

Public Class Form1 

    Private Sub GraduatesBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GraduatesBindingNavigatorSaveItem.Click 
     Me.Validate() 
     Me.GraduatesBindingSource.EndEdit() 
     Me.TableAdapterManager.UpdateAll(Me.Graduates_DatabaseDataSet) 

    End Sub 

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 
     'TODO: This line of code loads data into the 'Graduates_DatabaseDataSet.Graduates' table. You can move, or remove it, as needed. 
     Me.GraduatesTableAdapter.Fill(Me.Graduates_DatabaseDataSet.Graduates) 
    End Sub 

    Private Sub GraduatesBindingNavigator_RefreshItems(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GraduatesBindingNavigator.RefreshItems 

    End Sub 

    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) 

    End Sub 

    Private Sub PhotographLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) 

    End Sub 
    Private Sub SurnameTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SurnameTextBox.TextChanged 

    End Sub 

    Private Sub FillBysurnameToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) 
     Try 
      Me.GraduatesTableAdapter.FillBysurname(Me.Graduates_DatabaseDataSet.Graduates, SsnameToolStripTextBox.Text) 
     Catch ex As System.Exception 
      System.Windows.Forms.MessageBox.Show(ex.Message) 
     End Try 

    End Sub 
End Class 

回答

0

使用PictureBox並分配給它的Image酒店需要從VARBINARY(最大值)字段中的畢業生表中創建一個圖片對象,使用Image.FromStream建成。

不幸的是,沒有簡單的設計器時間綁定可以使用,您將不得不將事件掛接到您的數據綁定貨幣經理PositionChanged事件。