Could you please enlighten me with steps of how to overcome an error problem which really makes me stuck at all.
Well, am using vb.net 2005 and sql server...in vb.net, i was using picturebox.text to capture image from the user.
Am also using Bindings and tableadapters to generate the information from sql server..my server acts as designated server which lots of computers are using my server database...the sql server allows remote computers to share the database i have it in my server.
As far i did for my best, i created a table consisting 12 fields. 3 of them are images...their data types are images.
in vb.net, i have a save button which acts two multitasking functions..so i put the code for store image in the save button:1. task:
Private Sub Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Save.Click Private Sub addfile() Try Dim ms As New MemoryStream Legal_PhotoPictureBox.Image.Save(ms, Legal_PhotoPictureBox.Image.RawFormat) Dim photoimage() As Byte = ms.GetBuffer Dim signatureimage As Byte = ms.GetBuffer ms.close() Me.CustomersTableAdapter.Insert(Customer_IDTextBox.Text, FnameTextBox.Text, Other_nameTextBox.Text, Date_Of_BirthDateEdit.Text, Mobile_TelephoneTextBox.Text, Home_TelephoneTextBox.Text, Physical_AddressTextBox.Text, Postal_AddressTextBox.Text, EmailTextBox.Text, GenderComboBox.Text, CityComboBox.Text, NationalityComboBox.Text, PicturePictureBox.Image, signatureimage, Physical_Marks_signs_TextBox.Text, L_DocumentsComboBox.Text, photoimage, User_processorTextBox.Text) Catch ex As Exception End Try
2. second task for save button:
Me.Validate() Me.CustomersBindingSource.EndEdit() Me.TableAdapterManager.UpdateAll(Me.CustomerRegisterDataSet)
Therefore, am getting error messages if i remove one of the fields in the me.customerstableadapter.insert(customerID.text,....blah...upto....photoimage)...
Anyway, how can i shorten that insert table from the code...since the 2 task for save button saves all the information barring images, how can i remove others and put only the image in that customerttabledapter.insert(photoimage)
Or if you have another cool codes which suits my issue, please post it.
Or help me another easier methods of saving and retrieving images from sql server database with vb.net
I have got a table consists of more than 12 fields, so methods which only save the image in that table only would really be useful.
Thanks so much for reading my thread...and sorry for spelling error.
This post has been edited by Atli: 22 April 2012 - 07:50 AM
Reason for edit:: Please use [code] tags when posting code.