HI ,
I'm currently creating a system for medical record for our school project
i was wondering , if someone could help me.. i always get this error " Couldn't find 'C:/User/...' " i coudnt retrieve the filename of the picture so that i can store it in my database , BUT when I try my back up file it works .it save image in the Database
It's the same code , i did not change anything
here is a part my code.. please help :(
Private Sub MDISaveToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripButton.Click
If Not didPreviouslyConnect Then
MsgBox("Connecting to database")
End If
Dim isConnecting As Boolean = True
While isConnecting
oFullname = RegistrationForm.FirstNameTxt.Text & " " & RegistrationForm.MiddleInitialTxt.Text & " " & RegistrationForm.LastNameTxt.Text
oBirthday = RegistrationForm.MonthCBtxt.Text & RegistrationForm.DayCBtxt.Text & RegistrationForm.YearCBtxt.Text
Dim arrImage() As Byte
arrImage = System.IO.File.ReadAllBytes(RegistrationForm.OpenFileDialog1.FileName)
Try
Dim cmd As New SqlCommand("Insert into Patient_TB(Patient_ID, PatientName,PatientAddress,ContactNumber,Height,Weight,Gender,Bloodtype,Birthday,PatientPicture) " & _
" values( '" & RegistrationForm.PatientNoText.Text & "', '" & oFullname & "','" & RegistrationForm.AddressText.Text & "', '" & Trim(RegistrationForm.ContactNoTxt.Text) & "', '" & RegistrationForm.HeightTxtBox.Text & "', '" & RegistrationForm.WeightTxtbox.Text & "', '" + RegistrationForm.GenderCBtxt.SelectedItem + "', '" & RegistrationForm.BTypeTxt.Text & "','" & oBirthday & "',@PatientPicture)", dataconnect)
cmd.Parameters.Add(New SqlParameter("@PatientPicture", _
SqlDbType.Image, arrImage.Length)).Value = arrImage
dataconnect.Open()
cmd.ExecuteNonQuery()
dataconnect.Close()
isConnecting = False
didPreviouslyConnect = True
MessageBox.Show("Saved to the database", "System Message", MessageBoxButtons.OK, MessageBoxIcon.Information)
Catch
End Try
End While
thanks best of luck :)