我正在構建一個使用基於服務的數據庫的程序。VB.NET - 如何在這種情況下保存數據庫信息
我的第一個問題: 我想,當有人點擊其中一種顏色將一個String
存儲在像「COLOR_RED」數據庫
問題二: 我想,每個單選按鈕將存儲不同整數
數據庫模式:
相關代碼:
Public Class Form2
Private Sub TableBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles TableBindingNavigatorSaveItem.Click
Me.Validate()
Me.TableBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.Database1)
End Sub
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Database1.Table' table. You can move, or remove it, as needed.
Me.TableTableAdapter.Fill(Me.Database1.Table)
End Sub
Private Sub TableDataGridView_CellContentClick(sender As Object, e As DataGridViewCellEventArgs)
End Sub
Private Sub TableBindingNavigator_RefreshItems(sender As Object, e As EventArgs) Handles TableBindingNavigator.RefreshItems
End Sub
Private Sub Nb_typeRadioButton_CheckedChanged(sender As Object, e As EventArgs) Handles Nb_typeRadioButton.CheckedChanged
End Sub
Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click
PictureBox1.BorderStyle = BorderStyle.Fixed3D
PictureBox2.BorderStyle = BorderStyle.FixedSingle
PictureBox3.BorderStyle = BorderStyle.FixedSingle
PictureBox4.BorderStyle = BorderStyle.FixedSingle
PictureBox5.BorderStyle = BorderStyle.FixedSingle
End Sub
Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles PictureBox2.Click
PictureBox1.BorderStyle = BorderStyle.FixedSingle
PictureBox2.BorderStyle = BorderStyle.Fixed3D
PictureBox3.BorderStyle = BorderStyle.FixedSingle
PictureBox4.BorderStyle = BorderStyle.FixedSingle
PictureBox5.BorderStyle = BorderStyle.FixedSingle
End Sub
Private Sub PictureBox3_Click(sender As Object, e As EventArgs) Handles PictureBox3.Click
PictureBox1.BorderStyle = BorderStyle.FixedSingle
PictureBox2.BorderStyle = BorderStyle.FixedSingle
PictureBox3.BorderStyle = BorderStyle.Fixed3D
PictureBox4.BorderStyle = BorderStyle.FixedSingle
PictureBox5.BorderStyle = BorderStyle.FixedSingle
End Sub
Private Sub PictureBox4_Click(sender As Object, e As EventArgs) Handles PictureBox4.Click
PictureBox1.BorderStyle = BorderStyle.FixedSingle
PictureBox2.BorderStyle = BorderStyle.FixedSingle
PictureBox3.BorderStyle = BorderStyle.FixedSingle
PictureBox4.BorderStyle = BorderStyle.Fixed3D
PictureBox5.BorderStyle = BorderStyle.FixedSingle
End Sub
Private Sub PictureBox5_Click(sender As Object, e As EventArgs) Handles PictureBox5.Click
PictureBox1.BorderStyle = BorderStyle.FixedSingle
PictureBox2.BorderStyle = BorderStyle.FixedSingle
PictureBox3.BorderStyle = BorderStyle.FixedSingle
PictureBox4.BorderStyle = BorderStyle.FixedSingle
PictureBox5.BorderStyle = BorderStyle.Fixed3D
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Try
Me.Validate()
Me.TableBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.Database1)
Catch ex As Exception
MsgBox(ex.Message)
End Try
Try
Dim db As New Database1TableAdapters.TableTableAdapter
Dim dbimg As String = db.GetData.Rows(0).Item(1)
PictureBox1.Image = My.Resources.ResourceManager.GetObject(dbimg)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.Close()
End Sub
End Class
你嘗試編寫任何代碼,並告訴我們你的進展如何? –
問題是你沒有顯示任何企圖在你身上這樣做。 – OneFineDay
我的數據庫的一張圖片: http://srv1.jpg.co.il/4/54a859e4bf576.jpg 我厭倦了很多事情,但沒有什麼可能有助於理解。 – WoeIsMe