I'm trying to display multple but different images in the Datagridview, but I can seem to find a way how. Whenever I try to select different images only one is display in the Datagridview. I'm trying to insert the images in my DataGridView and Fatabase using the save button.
I try finding YT tutorials on how to display multple but different images in the database, but I can’t find a single one. I tried expirementing but it only displays 1 images in all the columns in the Datagridview and I am currently getting the “Parameters not valid” error right now. Please help!
Here’s my code. Whenever I try to run the program I keep on getting the “Parameters not valid” thing.
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
Try
cmd.Connection = con
cmd.CommandText = "INSERT INTO tbl_Dental ('Name', 'Address', 'Birthdate', 'Gender', 'Date', '55', '58', '53', '51', '55', '52', '56', '53', '55', '72', '71', '75', '74', '73', '72', '71', '73', '31', '33', '35', '31', '30', '32', '31', '31', '77', '61', '65', '68', '75', '81', '72', '73', '71', '80', '56', '52', '73', '68', '63', '55', '52', '56', '55', '72', '71', '75', '74', '73', '72', '71', '73', '31', '33', '35', '31', '30', '32', '31', '31', '77', '61', '65', '68', '75', '81', '72', '73', '71', '80', '56', '52', '73', '68', '63', '55', '52', '56', 'Dx', 'Trx')" &
" VALUES (@Name, @Address, @Birthdate, @Gender, @Date, @55, @58, @53, @51, @55, @52, @56, @53, @55, @72, @71, @75, @74, @73, @72, @71, @73, @31, @33, @35, @31, @30, @32, @31, @31, @77, @61, @65, @68, @75, @81, @72, @73, @71, @80, @56, @52, @73, @68, @63, @55, @52, @56, @55, @72, @71, @75, @74, @73, @72, @71, @73, @31, @33, @35, @31, @30, @32, @31, @31, @77, @61, @65, @68, @75, @81, @72, @73, @71, @80, @56, @52, @73, @68, @63, @55, @52, @56, @Dx, @Trx)"
cmd.Parameters.AddWithValue("@Name", txtName.Text)
cmd.Parameters.AddWithValue("@Address", txtAddress.Text)
cmd.Parameters.AddWithValue("@Birthdate", txtBdate.Text)
cmd.Parameters.AddWithValue("@Gender", txtGender.Text)
cmd.Parameters.AddWithValue("@Date", txtDate.Text)
cmd.Parameters.AddWithValue("@55", txt55.Text)
cmd.Parameters.AddWithValue("@58", txt58.Text)
cmd.Parameters.AddWithValue("@53", txt53.Text)
cmd.Parameters.AddWithValue("@51", txt51.Text)
cmd.Parameters.AddWithValue("@Dx", txtDx.Text)
cmd.Parameters.AddWithValue("@Trx", txtTrx.Text)
cmd.Parameters.AddWithValue("@Treatment", txtTreatment.Text)
If con.State = ConnectionState.Closed Then
conn.Open()
End If
cmd.ExecuteNonQuery()
con.Close()
MsgBox("Record Saved!")
txtName.Clear()
txtAddress.Clear()
txtAge.Clear()
txtBdate.Clear()
radMale.Checked = False
radFemale.Checked = False
txtDate.Clear()
txtAge.Clear()
txtDx.Clear()
txtTrx.Clear()
txtTreatment.Clear()
PictureBox1.Image = Nothing
PictureBox2.Image = Nothing
PictureBox3.Image = Nothing
PictureBox4.Image = Nothing
PictureBox5.Image = Nothing
PictureBox6.Image = Nothing
PictureBox7.Image = Nothing
PictureBox8.Image = Nothing
PictureBox9.Image = Nothing
PictureBox10.Image = Nothing
PictureBox11.Image = Nothing
PictureBox12.Image = Nothing
PictureBox13.Image = Nothing
PictureBox14.Image = Nothing
PictureBox15.Image = Nothing
PictureBox16.Image = Nothing
PictureBox17.Image = Nothing
PictureBox18.Image = Nothing
PictureBox19.Image = Nothing
PictureBox20.Image = Nothing
PictureBox21.Image = Nothing
PictureBox22.Image = Nothing
PictureBox23.Image = Nothing
PictureBox24.Image = Nothing
PictureBox25.Image = Nothing
PictureBox26.Image = Nothing
PictureBox27.Image = Nothing
PictureBox28.Image = Nothing
PictureBox29.Image = Nothing
PictureBox30.Image = Nothing
PictureBox31.Image = Nothing
PictureBox32.Image = Nothing
PictureBox33.Image = Nothing
PictureBox34.Image = Nothing
PictureBox35.Image = Nothing
PictureBox36.Image = Nothing
PictureBox37.Image = Nothing
PictureBox38.Image = Nothing
PictureBox39.Image = Nothing
PictureBox40.Image = Nothing
PictureBox41.Image = Nothing
PictureBox42.Image = Nothing
PictureBox43.Image = Nothing
PictureBox44.Image = Nothing
PictureBox45.Image = Nothing
PictureBox46.Image = Nothing
PictureBox47.Image = Nothing
PictureBox48.Image = Nothing
PictureBox49.Image = Nothing
PictureBox50.Image = Nothing
PictureBox51Image = Nothing
PictureBox52.Image = Nothing
PictureBox53.Image = Nothing
txtCx.Clear()
txtDx.Clear()
txtTx.Clear()
txtFx.Clear()
txtDrnx.Clear()
txtMdhx.Clear()
txtRx.Clear()
txtTsqx.Clear()
txtTreatmemnt.Clear()
LoadTable()
Catch ex As Exception
MsgBox(ex.Message)
Finally
If conn.State = ConnectionState.Open Then
conn.Close() I
End If
End Try
End Sub
Nyx Foster is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2