select * from Inquiry1 where title like '"+this.textbox.Text+"' UNION ALL select * from Inquiry2 where title like '"+this.textbox.Text+" 我是这样情况,我查出这些数据后,我要点他的时候传ID到另一个页面,另一个页面根据ID开始赋值,现在另一个页面接受ID的时候不知道是哪个表的!
我怎么判断其中一条是哪个表里的 ? 这两个表有是完全相同的,就是数据不同, 他们都有一个列Type 这列写着他是什么表.麻烦各位了, 请写详细点 谢谢
我怎么判断其中一条是哪个表里的 ? 这两个表有是完全相同的,就是数据不同, 他们都有一个列Type 这列写着他是什么表.麻烦各位了, 请写详细点 谢谢
解决方案 »
- 倾注所有分,求解答这段关于GPIO的程序
- winform界面最大化时布局闪烁问题
- 求教投骰子游戏程序
- 如何获取TemplateField中的控件内容?
- 一个不知道简单还是不简单的问题:无返回的函数如何“返回”?
- c#的DataView中的RowFilter中可以用几个and ?
- 在SQL2000中怎么样删除三个表里相关联的数据?
- Web Services 文件传输问题
- c#的HttpWebResponse 怎么老是报The underlying connection was closed
- 我自己实现一个枚举类型,但同时想用这个枚举类型声名一个变量该怎么办?
- 请教,WEB中的图像按钮怎么样才能排好。
- VS创建"服务"的一个错误提示,请大师指点
楼上有道理,可以将查询语句作下修改:
select *,type=1 from Inquiry1 where title like '"+this.textbox.Text+"'
UNION ALL
select *,type=2 from Inquiry2 where title like '"+this.textbox.Text+"
然后在接受页面,根据type的值就知道查哪个表了。。
select *,tablename='Inquiry1' from Inquiry1 where title like '"+this.textbox.Text+"'
UNION ALL
select *,tablename='Inquiry2' from Inquiry2 where title like '"+this.textbox.Text+"
<%# Eval("ID", "Answer.aspx?id={0}") %> 我传值 是这样 ,怎么传2个值
我现在是传1个ID , 要传2个 把TYPE 也传过去 该怎么写?
UNION ALL
select * ,'Inquiry2_'+Convert(Varchar(10),UserID) AS FROMTABLE from Inquiry2 where title like '"+this.textbox.Text+" Eval("FROMTABLE", "Answer.aspx?id={0}") %>
你获取到是 "Inquiry1_1" 切分字符串
String.Split("_")[0] =="Inquiry1"
String.Split("_")[1] =="1"
不就好了.
接受值页面 代码该怎么写? 接受Type 然后看这个值 去查是哪个表
你也真够懒得了!!string strType = Request.QueryString["type"]
string strID = Request.QueryString["id"]if (strType =="Inquiry1")
{
查询Inquiry1表
}
else if(strType=="Inquiry2")
{
查询Inquiry2表
}
Type值是表名还是其它?Page_Load(...)
{
string id=Request["id"];
string type = Request["type"];
string tablename = "";
if(type == "?")
{
tablename = ?;
}
//...
if(tablename=="")
{
Response.End();
}
string strsql = "select * from "+tablename+" where id="+id;
//查了
}
string strType = Request.QueryString["type"]
strType = "领奖�" 为什么最后一个字显示不出来 ?? 正确应该是 领奖类