楼主提到显示,是不是用DATAGRID显示?
一般我只有在INSERT,UPDATE,DELETE时才用sqlcommand
SELECT时,用dateset
SqlConnection sqlCon;
SqlDataAdapter sqlDA;
string sqlStmt;
sqlStmt="select * from customer where name='"+textBox1.Text+"';
sqlCon.Open();
sqlDA = new SqlDataAdapter(sqlStmt, sqlCon);
dataSet = new DataSet();
sqlDA.Fill(dataSet);
sqlCon.Close();
DataGrid1.DataSource=dataSet.Tables[0].DefaultView;