我有两个表poll和poll_answers,它们代表一个民意调查以及从民意调查中回答问题的选项.EX:
我在SQL上很差吗?
- 是
- 是的你是
- 改变工艺
以及共同回应的表格:
轮询
pollID pollQuestion
1 | Am I poor at SQL?
Run Code Online (Sandbox Code Playgroud)
poll_answers
pollAnswerID pollAnswerText pollID
1 | yes | 1
2 | yes, you do | 1
3 | change craft | 1
Run Code Online (Sandbox Code Playgroud)
这就是我获取数据的方式:
$polls=$db->get_results("SELECT pollID, pollQuestion FROM poll",ARRAY_A);
foreach ($polls as $poll_field)
{
$poll['id']=$poll_field['pollID'];
$poll['question']=$poll_field['pollQuestion'];
$tmp=$poll['id'];
//answers
$answers=$db->get_results("SELECT pollAnswerID, pollAnswerText FROM poll_answers WHERE pollID='$tmp'",ARRAY_A);
{
//and so on , I think you get the idea.
}
}
Run Code Online (Sandbox Code Playgroud)
它对我来说看起来非常笨拙,因为我认为在ID匹配时使用INNER JOIN只能使用一个SQL查询获取数据...我就是无法做到这一点.你能帮我吗?请记住,我的数据库中有多个民意调查.
编辑: …
我有一个SqlDataSource,它向我的GridView提供数据.多数民众赞成我在我的表格上使用,因此我根本没有任何代码.但在某些地方我需要一个TRY CATCH块以防万一我的连接丢失了.我必须在哪里放置什么代码?
如果我收到错误,我希望我的lblMessage文本为"无连接".
编辑
我的Machine.aspx中的GridView
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
Height="209px" PageSize="7" Width="331px" AllowSorting="True"
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="Total" HeaderText="Total" ReadOnly="True"
SortExpression="Total" DataFormatString="{0:R#,###,###}" >
<HeaderStyle HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="b134_rmcid" HeaderText="Machine" ReadOnly="True"
SortExpression="b134_rmcid" >
<HeaderStyle HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="b134_recdate" DataFormatString="{0:d/MM/yyyy}"
HeaderText="Date" ReadOnly="True" SortExpression="b134_recdate" >
<HeaderStyle HorizontalAlign="Left" />
</asp:BoundField>
</Columns>
</asp:GridView>
Run Code Online (Sandbox Code Playgroud)
我的连接就在我的Machine.aspx中的Gridview下
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ODBC_ConnectionString %>"
ProviderName="<%$ ConnectionStrings:ODBC_ConnectionString.ProviderName %>"
SelectCommand="SELECT SUM(b134_nettpay) AS Total, b134_rmcid, b134_recdate FROM B134HRE"
onselected="SqlDataSource1_Selected">
</asp:SqlDataSource>
Run Code Online (Sandbox Code Playgroud)
我的Code.aspx.cs中的Code Behind文件中的代码
protected void Page_Load(object sender, EventArgs e)
{
lblError.Text …Run Code Online (Sandbox Code Playgroud) 发布我的应用程序后,除default.aspx之外,网站中没有任何链接可用.当我点击它们时,会显示"找不到页面".我想,这是关于路由.但我没有对默认的mvc路由设置进行任何更改.什么可能导致这种事情?
谢谢.
VS2008在关闭并再次打开时,或者从编码到调试再返回时,在移动窗口并丢失选项卡时遇到问题。(是的,我知道应该为编码和调试保存不同的布局)。我尝试导出设置,但是它可以帮助我
“您的设置已导出,但存在一些错误。错误1:由于内部错误,某些命令栏设置未正确导出。”
再次导入它们会产生类似的错误,并且不能解决问题。有人知道VS将布局信息保存在何处吗?或者如何在不更改所有其他设置的情况下重新初始化布局?谢谢!
在最近的一个问题中,我收到了一些建议,其中包括JavaScript的方面,其中函数是"第一类"对象.与其他对象相比,"第一类"在这种情况下意味着什么?
编辑(JörgWMittag):完全重复:"什么是一流的编程结构?"
我在项目中使用以下post构建操作,将lib合并到我的应用程序中:
IF $(ConfigurationName) == Debug GOTO end
cp $(TargetPath) $(TargetDir)app_unmerged.exe
del $(TargetPath)
"C:\Program Files\Microsoft\ILMerge\ilmerge.exe" /internalize $(TargetDir)MyApp_unmerged.exe $(TargetDir)someLib.dll /out:$(TargetDir)myApp.exe
del $(TargetDir)myApp_unmerged.exe $(TargetDir)someLib.dll
:end
Run Code Online (Sandbox Code Playgroud)
这很好用.现在我有一个安装程序项目并添加了项目输出.我希望使用"主要输出来源",即/ bin/Release中的exe.但实际上使用的是/bin/release/myApp.exe,而不是/obj/release/myApp.exe.
有谁知道我是否可以更改此行为并使用/ bin/release中的输出作为安装程序项目?谢谢.
我想知道你是否可以帮助我制定一个正则表达式来匹配以下模式?
任意长度的任意数字字符串,可以是0x,也可以不是0x.
有没有办法只发送带有链接的图像和RSS源中每个项目的替代文本?
我查看了enclosure标签,但这仅适用于视频和音乐.
我有一个用Cassini开发和测试的mvc应用程序.在GoDaddy上部署到我的网站,默认页面就可以了.点击登录,我得到404.
我在IIS 7下运行,所以这是出乎意料的.我的路线很简单:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Public", action = "Index", id = "" }
);
routes.MapRoute(
"Report1",
"Report/{action}/{start}/{end}",
new { controller = "Report", action = "Index" }
);
routes.MapRoute(
"Report2",
"Report/{action}/{start}/{end}/{idList}",
new { controller = "Report", action = "Index" }
);
Run Code Online (Sandbox Code Playgroud)
知道可能会发生什么或我如何解决这个问题?
我正在使用Zend_Search_Lucene来实现站点搜索.我为不同的数据类型创建了单独的索引(例如,一个用于用户,一个用于帖子等).结果类似地按数据类型划分,但是有一个'all'选项应该显示不同结果类型的组合.是否可以一次搜索不同的指数?或者我必须索引所有索引中的所有内容?
更新:ZF 1.8 的自述文件表明现在可以在ZF 1.8中进行,但我无法在文档中找到它的位置.
asp.net ×2
asp.net-mvc ×2
.net ×1
c# ×1
datagridview ×1
httphandler ×1
iis ×1
iis-7 ×1
image ×1
installer ×1
javascript ×1
layout ×1
lucene ×1
mysql ×1
php ×1
publishing ×1
regex ×1
rss ×1
search ×1
sql ×1
vb.net ×1