加入表格所需的帮助 [英] Help needed in Join the table
本文介绍了加入表格所需的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我必须从三个表中加入字段.
你能纠正一下吗?
Hi
I have to join fields from three table.
could you please correct
string selectcmd = " SELECT a.DoDate,a.DoNumber,a.CusId,b.CompName,b.CompAddress,b.Tel,b.Fax,b.ContPerson,b.SalesPerson,c.ItemNo,c.Description,c.Qty from ItemParent a,CustomerDetail b,ItemParent c INNER JOIN b ON a.CusId = b.CusId,INNER JOIN c ON c.DoNumber = b.DoNumber";
SqlCommand cmd = new SqlCommand(selectcmd, conn);
conn.Open();
reader = cmd.ExecuteReader();
conn.Close();
谢谢
Thanks
推荐答案
选择a.DoDate,a.DoNumber,a.CusId,b.CompName,b.CompAddress,b.Tel,b.Fax,b.ContPerson ,b.SalesPerson,c.ItemNo,c.Description,c.Qty来自ItemParent一个内部联接CustomerDetail b ON a.CusId = b.CusId内部联接ItemParent c ON c.DoNumber = b.DoNumber"
使用上面的查询,让我知道.....
SELECT a.DoDate,a.DoNumber,a.CusId,b.CompName,b.CompAddress,b.Tel,b.Fax,b.ContPerson,b.SalesPerson,c.ItemNo,c.Description,c.Qty from ItemParent a inner join CustomerDetail b ON a.CusId = b.CusId inner join ItemParent c ON c.DoNumber = b.DoNumber"
Use this above query and let me know.....
请改用此查询:
Use this query instead:
SELECT a.DoDate,
a.DoNumber,
a.CusId,
b.CompName,
b.CompAddress,
b.Tel,b.Fax,
b.ContPerson,
b.SalesPerson,
c.ItemNo,
c.Description,
c.Qty
from ItemParent
INNER JOIN CustomerDetail b ON a.CusId = b.CusId
INNER JOIN ItemParent c ON b.DoNumber = c.DoNumber
问候,
爱德华
Regards,
Eduard
尝试一下:
try this:
private void BindGridData()
{
DataTable dt = new DataTable();
strSql = "SELECT EmpView.EMP_NAME,EmpView.DESIG_NAME, EMP_PUBLICATION.EMPCODE,EMP_PUBLICATION.TITLE, EMP_PUBLICATION.DOWNLOADFILE ,EMP_PUBLICATION.EXT_LINK, EMP_PUBLICATION.ENTRY_DATE "
+ " FROM EMP_PUBLICATION INNER JOIN "
+ "EmpView ON EMP_PUBLICATION.EMPCODE = EmpView.EMP_ID ";
dt = ObjGenFun.execute_dataset("TR", strSql).Tables[0];
GridShow.DataSource = dt;
GridShow.DataBind();
}
这篇关于加入表格所需的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文