1

如何更改“COMP”以检查我在组合框类别上选择的内容?

我的文本框是 cmbCategory

cmd = New SqlCommand("SELECT * FROM tblOfficeEquipmentSubCategory Where CAT_ID='COMP'", sqlconn)
If sqlconn.State = ConnectionState.Closed Then sqlconn.Open()
Dim sdr As SqlDataReader = cmd.ExecuteReader()
sdr.Close()
4

1 回答 1

0

尝试这样的事情:

cmd = New SqlCommand("SELECT * FROM tblOfficeEquipmentSubCategory Where CAT_ID=@Category", sqlconn)
cmd.Parameters.Add("@Category", SqlDbType.NVarChar, -1).Value = cmbCategory.SelectedText
If sqlconn.State = ConnectionState.Closed Then sqlconn.Open()
Dim sdr As SqlDataReader = cmd.ExecuteReader()
sdr.Close()
于 2013-03-25T05:48:25.500 回答