可以的,这里看一个datalist的样例
<script language="C#" runat="server">
   void Page_Load(Object sender, EventArgs e) 
   {
      // Create a connection to the "pubs" SQL database located on the 
      // local computer.
      SqlConnection myConnection = new SqlConnection("server=localhost;" +
         "database=pubs;Trusted_Connection=Yes");
      // Connect to the SQL database using a SQL SELECT query to get all 
      // the data from the "Titles" table.
      SqlDataAdapter myCommand = new SqlDataAdapter("SELECT * " +
         " from Titles", myConnection);
      // Create and fill a DataSet.
      DataSet ds = new DataSet();
      myCommand.Fill(ds);
      // Bind MyDataList to the DataSet. MyDataList is the ID for 
      // the DataList control in the HTML section of the page.
      MyDataList.DataSource = ds;
      MyDataList.DataBind();
   }
</script>