我有两张表facultynew和studentrecords.,。Facultynew 包括字段 FacultyID、FacultyFirstName、FacultyLastname、Course、Image、Level 而学生记录包括 IDNumber、Firstname、MiddleName、Course
我有 1 个文本框和图片框以及 1 个按钮
我的文本框已经可以使用了。,.,当我使用我的 IDNumber 登录时,它将显示 IDnumber 的过程。,.,它已经可以了.,.,.,
我的问题是加载教师,如果我单击按钮 ex.txtbox=BSIT 然后加载数据库中的所有 BSIT 课程教师。,., 将其图片加载到图片框中.,., 保存到数据库中的图片.,.只要二进制数据
如果学生课程 = BSIT 然后加载在图片框上教授 BSIT 的院系 IMAGE 我只是一个新手..,
我有一个代码,但我需要专家的帮助,.,.此代码不加载
Dim con As New OleDbConnection
Dim dr As OleDbDataReader
Dim arrImage() As Byte
Dim myMS As New IO.MemoryStream
Dim cmd As New OleDbCommand
Dim strcourse As String
Dim sSQL As String
Dim da As New OleDb.OleDbDataAdapter
' con = New OleDbConnection(Get_Constring)
' con.Open()
' strcourse = "select Course from facultynew where FacultyID"
' strcourse1 = "select Course from studentsrecords where IDNumber"
' da = New OleDb.OleDbDataAdapter(strcourse, con)
' da = New OleDb.OleDbDataAdapter(strcourse1, con)
' MsgBox("asdasd")
sSQL = "SELECT b.Course, b.Image, a.IDNumber"
sSQL = sSQL & " FROM studentsrecords as a left join facultynew as b"
sSQL = sSQL & " on a.Course = b.Course WHERE(b.FacultyLastName = @FacultyLastName) order by a.IDNumber"
con = New OleDbConnection(Get_Constring)
con.Open()
cmd.Connection = con
cmd.CommandType = CommandType.Text
cmd.CommandText = sSQL
cmd.Parameters.AddWithValue("@FacultyLastName", OleDbType.VarChar).Value = DBNull.Value
'cmd.Parameters.Add("@Course", OleDbType.BigInt).Value = ifacID
'cmd.Parameters.Add("@IDNumber", OleDbType.BigInt).Value = ieval
'= IIf(Len(Trim(Me.txtFacultyLastName.Text)) > 0, Me.txtFacultyLastName.Text, DBNull.Value)
dr = cmd.ExecuteReader
If dr.HasRows Then
While dr.Read
If Not IsDBNull(dr("Image")) Then
myMS = New IO.MemoryStream
arrImage = dr("Image")
For Each ar As Byte In arrImage
myMS.WriteByte(ar)
Next
End If
Select Case dr("IDNumber")
Case 1
Me.pic1.Tag = dr("b.Course")
Me.pic1.Image = System.Drawing.Image.FromStream(myMS)
End Select
End While
End If