Combobox databinding showing system.data.datarowview

后端 未结 7 1590
猫巷女王i
猫巷女王i 2021-01-01 00:08

I am binding combobox with datasource, displaymember, valuemember. It is working fine in my computer but it is not working in clients pc. Following is my source code:

<
7条回答
  •  悲哀的现实
    2021-01-01 00:14

    "comboBox1.SelectedValue" returns object and you want as string so convert it Convert.ToString(comboBox1.SelectedValue) and then use

    for example:

      tempcmd = new SqlCommand("SELECT specification,alloyCode FROM alloy where alloyId='" + Convert.ToString(cbxMetal.SelectedValue) + "'", con);
    

提交回复
热议问题