小编pre*_*yv5的帖子

从数据库中的combobox中连接两列

我试图连接两列但出现问题....我的输出没有显示.

String Query = " SELECT pa_forename , pa_surname FROM [ICPS].[dbo].[parking_attendants] order by pa_forename ";
 SqlConnection conDataBase = new SqlConnection(conString);
 SqlCommand cmdDataBase = new SqlCommand(Query, conDataBase);
 SqlDataReader myReader;
  try
{
  conDataBase.Open();
  myReader = cmdDataBase.ExecuteReader();
 while (myReader.Read())
                {
string pa_forename = myReader["pa_forename " +"," + "pa_surname"].ToString();
 comboBox1.Items.Add(pa_forename);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);

            }
Run Code Online (Sandbox Code Playgroud)

c# sql string sqldatareader

1
推荐指数
1
解决办法
1002
查看次数

标签 统计

c# ×1

sql ×1

sqldatareader ×1

string ×1