我正在尝试使用通配符查询在 gridview 中显示行,但它不符合标准......
protected void Button1_Click(object sender, EventArgs e)
{
SqlCommand com = new SqlCommand("select * from Alphabates where Word
like'"+TextBox1.Text+"'", new SqlConnection("data source=
USER\\SQLEXPRESS;initial catalog=vicky;integrated
security=true"));
try
{
com.Connection.Open();
GridView1.DataSource = com.ExecuteReader();
GridView1.DataBind();
com.Connection.Close();
com.Connection.Dispose();
}
catch (SqlException ex)
{
Label1.Text = ex.Message;
}
}