富国沪深
string sql = "select * from tablename where id = @id"; SqlConnection connection = new SqlConnection("数据库连接字符串"); SqlDataAdapter da = new SqlDataAdapter(sql, connection); da.SelectCommand.Parameters.AddWithValue("@id", 1); DataSet ds = new DataSet(); da.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { object[] array = ds.Tables[0].Rows[0].ItemArray; }