C#如何对Access进行多表查询
string ConStr = "provider=Microsoft.jet.oledb.4.0;data source=" + Application.StartupPath + @"\MYText.mdb";
OleDbConnection Olecon = new OleDbConnection(ConStr);
Olecon.Open();
//string sql = "Select * from 学生信息 where 学号= '" + textBox1.Text.Trim() + "' ";
string sql = "Select Score ,Student from Student,Score where Score.STU_ID=Student.STU_ID";
//string sql = "Select * from Score where Score.STU_ID=Student.STU_ID";
//sql += sql + '"textBox1.Text.Trim()"';
OleDbDataAdapter da = new OleDbDataAdapter(sql, Olecon);
DataSet ds = new DataSet();
da.Fill(ds);
this.dataGridView1.DataSource = ds.Tables[0];
这是我的代码:
错误:至少一个参数没有被指定值
debug一下,看看具体哪个参数没赋值。
"Select Score.[Score] ,Student.[Student] from Student,Score where Score.STU_ID=Student.STU_ID";
没有用啊……
相关问答:
我在模块里自定义了一个函数:stradd()
可是在adoquery1.sql.add('select stradd(author) from book');
时提示stradd未定义...
这个问题有什么办法可以解决的吗? 非常感激!
(在A ......
最近在做个网上商城,购物车模块,没有做过,麻烦各位帮忙说下大致说下思路,能发一份源码更好。小弟先谢过各位了;
QQ:413763818;
eamil:swebook@126.com
网上一大堆!
www.51aspx.com
去下 ......
在数据库中有张表,有id,name两列,id 是主键,没有设置自增属性,在程序中取出这张表放入datatable,在这个datatable中插入一条记录,当更新数据库时提示id列不能为空,请问该怎么解决?
给它一个值!!主键不能为空 ......
我在CB练创建ACCESS文件,
采用的下列代码,我专门先做个小程序测试,一切正常。
然后在加载到1个软件中,
传入的变量MDB_PathName也是正确的。
但在执行
mdb.OleFunction("Create", ......
已知两个数据库,分别为BASE.MDB 和 BASE2.DBF
字段分别为BASE.MDB:NAME NAME2 NAME3
A B C
D E F
......