SqlConnection stt = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["stt"]);
stt.Open();
DataSet ds2 = new DataSet();
SqlDataAdapter sda = new SqlDataAdapter("select studentname ,year
from studentinformation where year='Convert.ToDateTime(" + yearlist.SelectedValue.ToString() + "-" + monthlist.SelectedValue.ToString() + "-" + daylist.SelectedValue.ToString() + ").ToShortDateString()'", stt);
sda.Fill(ds2, "tab1");
GridView2.DataSource = ds2.Tables["tab1"];
GridView2.DataBind();
stt.Close();
提示说
此句
sda.Fill(ds2, "tab1");
从字符串转换为 datetime 时发生语法错误。
[[it] 本帖最后由 meteor86 于 2008-4-14 19:31 编辑 [/it]]