DataSet DS=new DataSet(); cn.open(); SqlDataAdapter Da=new SqlDataAdapter(select * from aaa where charindex(str_a,b_column)>=0 or charindex(str_b,b_column)>=0,cn); Da.Fill(DS,"table"); DataGrid1.DataSource=DS.Tables[0].DefaultView; DataGrid1.DataBind();
DataSet DS=new DataSet(); cn.open(); sql = "select * from aaa where b_column like '%str_a%' and b_column like '%str_b%'"; SqlDataAdapter Da=new SqlDataAdapter(sql,cn); Da.Fill(DS,"table"); DataGrid1.DataSource=DS.Tables[0].DefaultView; DataGrid1.DataBind();
sql = "select * from aaa where b_column like '%str_a%' and b_column like '%str_b%'";同时包含用 and 包含一个用 or
关键就是这个: sql = "select * from aaa where b_column like '%str_a%' and b_column like '%str_b%'";同时包含用 and 包含一个用 or这些楼上的兄弟已经说了:(
程序出错了: 未处理的“System.Data.SqlClient.SqlException”类型的异常出现在 system.data.dll 中。 其他信息: 系统错误。 tableName = "T_i_00_A"; string SQLString = "select * from " + tableName + " where aufnr like '%NA0310%' "; common.theAdapter = new SqlDataAdapter( SQLString , common.Cn); common.theDataSet = new DataSet(); common.theAdapter.Fill(common.theDataSet, ??? );-------停在此句了。请问:此处的表名是自己设置的吗,是否要和下面一句的???对应起来 this.dataGrid1.DataSource = common.theDataSet.Tables[???];
select * from 表 where 字段 like '%关键字%'或: select * from 表 where charindex('关键字',字段)>0或: select * from 表 where patindex('%关键字%',字段)>0
cn.open();
SqlDataAdapter Da=new SqlDataAdapter(select * from aaa where charindex(str_a,b_column)>=0 or charindex(str_b,b_column)>=0,cn);
Da.Fill(DS,"table");
DataGrid1.DataSource=DS.Tables[0].DefaultView;
DataGrid1.DataBind();
cn.open();
sql = "select * from aaa where b_column like '%str_a%' and b_column like '%str_b%'";
SqlDataAdapter Da=new SqlDataAdapter(sql,cn);
Da.Fill(DS,"table");
DataGrid1.DataSource=DS.Tables[0].DefaultView;
DataGrid1.DataBind();
sql = "select * from aaa where b_column like '%str_a%' and b_column like '%str_b%'";同时包含用 and 包含一个用 or这些楼上的兄弟已经说了:(
未处理的“System.Data.SqlClient.SqlException”类型的异常出现在 system.data.dll 中。
其他信息: 系统错误。
tableName = "T_i_00_A";
string SQLString = "select * from " + tableName + " where aufnr like '%NA0310%' ";
common.theAdapter = new SqlDataAdapter( SQLString , common.Cn);
common.theDataSet = new DataSet();
common.theAdapter.Fill(common.theDataSet, ??? );-------停在此句了。请问:此处的表名是自己设置的吗,是否要和下面一句的???对应起来
this.dataGrid1.DataSource = common.theDataSet.Tables[???];
select * from 表 where charindex('关键字',字段)>0或:
select * from 表 where patindex('%关键字%',字段)>0
@tableName varchar(10)@tableName=txtTableName.text
如果NA0310为变量
string SQLString = "select * from T_i_00_A like %"+NA0310+"% ";