SQL两个表连接查询 - .NET技术 / C#
两个表:
产品类型表 tnclass :ID,name
产品表 tbproduct :ID,title,classid(classid就是表tbclass的那个ID),author,src
现在要根据一个产品的 id 显示这个产品的所有信息
产品标题,产品类型,产品发布人,产品图片
但我的结果显示产品类型的是id号1、2、3、4,其它的没问题,求助各位帮我改一下,谢谢了
我用的是 microsoft visual studio2005 c# 数据库是 SQL Server 2005
后台代码:
protected void Page_Load(object sender, EventArgs e)
{
string id = Request["id"];
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "Data Source=.\\SQLEXPRESS;Integrated Security=True;Connect Timeout=30;User Instance=True;AttachDbFilename=" + Server.MapPath("\\XM_WebSites\\App_Data\\product.mdf");
conn.Open();
SqlCommand cmd = new SqlCommand("select * from tbproduct where id='" + id + "'",conn);
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = cmd;
DataSet ds = new DataSet();
sda.Fill(ds, "tbproduct");
PagedDataSource pds = new PagedDataSource();
pds.AllowPaging = true;
pds.CurrentPageIndex = 0;
pds.PageSize = 1;
pds.DataSource = ds.Tables["tbprod
相关问答:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jas ......
txt 和XML 格式相应
不借助DataSet
导入读取TXT文件
然后直接写入XML(同一文件,不同数据,递增原数据没有被覆盖情况下增加数据.)
教个要点或最好是有个代码提示的
过路好汉 帮个忙撒^^
不会,帮楼主 ......
如何在SQL2005中设定定时作业,比如说定时清理某些表的数据,
或者是定时的将某些表的数据导出excel!
在线等待,急急急,最好是详细步骤!
之前我做的作业有点问题!
帮UP
参考:http://hi.baidu.com/toiota ......
字段1,字段2.....字段N,Status,ParentID
1,Name1....test1,1,99
1,Name1....test1,3,99
1,Name2....test2,1,101
1,Name2....test2,3,101
1,Name3....test3,2,101
1,Name1....test1,4,101
想要的结果是:
1,Na ......