如何使用VB将Combobox和CheckedListBox保存到MySQL PHP中

时间:2018-11-27 15:50:42

标签: mysql vb.net

我正在使用vb2017。我尝试将组合框值和复选框列表项保存到数据库中。数据库表仅对组合框显示“ System.Data.DataRowView”,对复选框框显示“ System.Windows.Forms.CheckedListBox + ObjectCollection”。谁能帮我?我正在使用mysql phpmyadmin作为数据库。这是我在下面使用的代码。它显示没有错误。但是所选项目的值未显示在数据库表中。

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

Dim constr As String = "server=localhost;user=root;database=login;port=3306;password=root123;SslMode=none"
Dim conn As MySqlConnection = New MySqlConnection(constr)
Dim result As Integer
'If True Then
Try
    conn.Open()
    With {}
        Dim cmd As MySqlCommand
        For Each item In CheckedListBox1.CheckedItems
            cmd = New MySqlCommand("INSERT INTO mastersubject(name,subjectpriority) VALUES(@name,@subjectpriority)", conn)
        Next
        cmd.Parameters.AddWithValue("@name", ComboBox1.SelectedItem.ToString)
        cmd.Parameters.AddWithValue("@subjectpriority", CheckedListBox1.Items.ToString())
        result = cmd.ExecuteNonQuery()
        'conn.Close()
    End With
    'End If

    If result > 0 Then

        MsgBox("Record has been saved")

    Else
        MsgBox("Error!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
    End If

Catch ex As Exception
    Console.WriteLine(ex.ToString())
    MsgBox(ex.Message)

Finally
    conn.Close()
End Try

End Sub

1 个答案:

答案 0 :(得分:0)

评论和解释在一行中。

return(
   <View style={{ width: "100%",height: "100%", flex: 1}}>
      <View style={{flex:0.7,justifyContent:'center'}}>
          <Video
           source={{ uri: url }}
           isMuted={false} 
           shouldPlay
           isLooping
           usePoster={true} 
           useNativeControls={false}
           />
       </View>
      <View style={{flex:0.1}}/>
      <TouchableOpacity style={{flex:0.1,paddingHorizontal:10}}>
           <View style={{width:"100%",justifyContent:"center",alignItems:"center",backgroundColor:"blue"}}>
            <Text>Next</Text>
           </View>
      </TouchableOpacity>
   </View>
 )