找错误
string sconn = "uid=sa;pwd=;database=tu;server= ";
string keyword = Request[ "keyword "];
string searchword = Request[ "searchword "];
if (string.IsNullOrEmpty(keyword) || string.IsNullOrEmpty(searchword))
{
Response.Redirect( "Default.aspx ");
}
else
{
string sql = "select * from TABLE where " + keyword + " like %& " + searchword + "&% ";
SqlConnection conn = new SqlConnection(sconn);
conn.Open();
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
DataSet ds = new DataSet();
da.TableMappings.Add( "TABLE ", "TABLE ");
da.TableMappings[0].ColumnMappings.Add( "TITLE ", "TITLE ");
da.TableMappings[0].ColumnMappings.Add( "AUTHER ", "AUTHER ");
da.TableMappings[0].ColumnMappings.Add( "ISBS ", "ISBS ");
da.TableMappings[0].ColumnMappings.Add( "LECTURER ", "LECTURER ");
da.TableMappings[0].ColumnMappings.Add( "UNITCODE ", "UNITCODE ");
da.TableMappings[0].ColumnMappings.Add( "COPY ", "COPY ");
da.Fill(ds);
DataGrid1.DataSource = ds.Tables[ "TABLE "].DefaultView;
ViewState[ "Row "] = ds.Tables[ "TABLE "].DefaultView.Count;
DataGrid1.DataBind();
}
------解决方案--------------------