vs2010用c#+access数据库做程序,不显示数据
stringconnectionString=@"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=H:\大童小衣数据库\DTXY....
string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=H:\大童小衣数据库\DTXY.mdb;Persist Security Info=False;";
string sql = "select ClotheNo,Present,ClotheStyle,ClassName,IntoPrice,OutPrice,Profit,Brand,ClotheSize,Num from Clothe,ClassInfo where Clothe.ClassNo=ClassInfo.ClassNo and ClotheNo like '**' and Clothe.ClassNo like '**' and Brand like '**' and ClotheStyle like '**' and ClotheSize like '**' and Num>0";
OleDbConnection connection = new OleDbConnection(connectionString);
connection.Open();
OleDbDataAdapter sda = new OleDbDataAdapter(sql, connection);
DataTable de = new DataTable();
sda.Fill(de);
dgvClothe.DataSource=de;
上边的代码哪错了?SQL语句在access查询中运行了,数据出来了,但放到这里就是不出来。我也换成别的SQL语句,例如“select * from Clothe”,这个就能出来,说明不是其他语句的错误。求助!! 展开
string sql = "select ClotheNo,Present,ClotheStyle,ClassName,IntoPrice,OutPrice,Profit,Brand,ClotheSize,Num from Clothe,ClassInfo where Clothe.ClassNo=ClassInfo.ClassNo and ClotheNo like '**' and Clothe.ClassNo like '**' and Brand like '**' and ClotheStyle like '**' and ClotheSize like '**' and Num>0";
OleDbConnection connection = new OleDbConnection(connectionString);
connection.Open();
OleDbDataAdapter sda = new OleDbDataAdapter(sql, connection);
DataTable de = new DataTable();
sda.Fill(de);
dgvClothe.DataSource=de;
上边的代码哪错了?SQL语句在access查询中运行了,数据出来了,但放到这里就是不出来。我也换成别的SQL语句,例如“select * from Clothe”,这个就能出来,说明不是其他语句的错误。求助!! 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询