如何在item()函数中插入一个来自Mysql命令的连接字符串

时间:2017-02-20 09:53:39

标签: mysql vb.net

这是我的代码

 Select Case activebarangay
        Case "Barangay Barangka"
            DataGridView1.DataSource = Exec("Select * from barangka_logbook")

            reader = ExecReader("Select family_number from barangka_patient_infomation")

            If reader.HasRows Then

                While reader.Read
                    familynumberComboBox.Items.Add(reader.Item("family_number"))
                End While
            End If

            'Member name
            reader = ExecReader("Select concat(first_name,' ',middle_name,' ',last_name) from barangka_patient_infomation WHERE family_number = '" & familynumberComboBox.Text & "' ")

            If reader.HasRows Then

                While reader.Read
                    membernameComboBox.Items.Add(reader.Item("concat(first_name,' ',middle_name,' ',last_name)"))
                End While
            End If

这就是我所说的如果可以将Item()函数放入一个连接的字符串中:

 If reader.HasRows Then
     While reader.Read
         membernameComboBox.Items.Add(reader.Item("concat(first_name,' ',middle_name,' ',last_name)"))
     End While

怎么会这样?请帮我                 结束如果

1 个答案:

答案 0 :(得分:1)

使用选择列表中的$now = new DateTime(date('Y-m-d H:i:s')); $duration = (new DateTime("+1 year"))->diff($now); echo $duration->format('%a'); 关键字提供字段别名,并使用别名来引用连接字段:

as