SQL Server与服务器之间的SQL请求问题Visual Studio Web开发. [英] SQL request issue between SQL Server & Visual Studio Web Dev.

查看:49
本文介绍了SQL Server与服务器之间的SQL请求问题Visual Studio Web开发.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我正在开发一个asp.net网页,该网页显示来自SQL Server的数据.
一切正常,但是,当我在SQL数据库中添加新数据时,它们未出现在gridview中.
我已经在Visual Studio Web Developer的工具中测试了我的请求,遇到了同样的问题,所以我认为我的请求是错误的!
但是,在SQL Server Management Studio Express中,我的所有数据均以相同的请求出现.

这是一种错误还是我忘了设置?
谢谢

Hello everybody,
i''m developing a asp.net web page which display data from a SQL Server.
All works fine however, when i add new data on my SQL Data Base they don''t appear in the gridview.
I''ve tested my request in the tool on Visual Studio Web Developer the same problem, so I thought that my request is wrong !
However in SQL Server Management Studio Express there are no problems all my data appear with the same request.

This is a kind of bug or something i forget to set ?
Thanks you

<asp:Content ID="Content3" runat="server"

    contentplaceholderid="ContentPlaceHolder2">
    <asp:GridView ID="GridView1" runat="server"

    AutoGenerateColumns="False" DataSourceID="SqlDataSource1" Height="683px"

    Width="643px" style="margin-left: 0px">
                        <Columns>
                            <asp:BoundField DataField="adacc" HeaderText="Account" SortExpression="adacc" />
                            <asp:BoundField DataField="department" HeaderText="Department"

                                SortExpression="department" />
                            <asp:BoundField DataField="SPE" HeaderText="SPE"

                                SortExpression="SPE" />
                            <asp:BoundField DataField="hostname" HeaderText="Hostname"

                                SortExpression="hostname" />
                            <asp:BoundField DataField="location" HeaderText="Location"

                                SortExpression="location" />
                            <asp:BoundField DataField="software" HeaderText="Software"

                                SortExpression="software" />
                            <asp:BoundField DataField="genacc_user_adacc" HeaderText="Users"

                                SortExpression="genacc_user_adacc" />
                            <asp:BoundField DataField="pass" HeaderText="pass" SortExpression="PWD Encrypted" />
                        </Columns>
</asp:GridView>
<!-- SQL Request without login dectection ((    <%Response.Write(getuserID)%>    ))-->
<asp:SqlDataSource ID="SqlDataSource1" runat="server"

                EnableCaching="True"

                FilterExpression="genacc_user_adacc = 'HERMANS5'"

                ConnectionString="<%$ ConnectionStrings:LabAccManConnectionString %>"



        SelectCommand="SELECT     genacc_account.adacc, genacc_account.department, genacc_account.SPE, genacc_machines.hostname, genacc_machines.location,
                      genacc_machines.software, account_user.genacc_user_adacc, genacc_pw.pass
FROM         genacc_account INNER JOIN
                      genacc_machines ON genacc_account.id = genacc_machines.genacc_account_id INNER JOIN
                      account_user ON genacc_account.id = account_user.genacc_account_id INNER JOIN
                      genacc_pw ON genacc_account.id = genacc_pw.genacc_account_id">


</asp:SqlDataSource>

推荐答案

ConnectionStrings:LabAccManConnectionString %> " span> SelectCommand =" 选择genacc_account.adacc,genacc_account.department,genacc_account.SPE,genacc_machines.hostname,genacc_machines.location, genacc_machines.software,account_user.genacc_user_adacc,genacc_pw.pass 来自genacc_account INNER JOIN genacc_machines ON genacc_account.id = genacc_machines.genacc_account_id INNER JOIN account_user ON genacc_account.id = account_user.genacc_account_id INNER JOIN genacc_pw ON genacc_account.id = genacc_pw.genacc_account_id" < /asp:SqlDataSource >
ConnectionStrings:LabAccManConnectionString %>" SelectCommand="SELECT genacc_account.adacc, genacc_account.department, genacc_account.SPE, genacc_machines.hostname, genacc_machines.location, genacc_machines.software, account_user.genacc_user_adacc, genacc_pw.pass FROM genacc_account INNER JOIN genacc_machines ON genacc_account.id = genacc_machines.genacc_account_id INNER JOIN account_user ON genacc_account.id = account_user.genacc_account_id INNER JOIN genacc_pw ON genacc_account.id = genacc_pw.genacc_account_id"> </asp:SqlDataSource>


插入数据后,必须要求再次绑定网格才能查看插入的数据.

因此,您按下保存呼叫数据的按钮将在数据成功保存后进行绑定.
After inserting data you must require to bind your grid again to view your inserted data.

so ones you press save call databind once data saved successfully.


这篇关于SQL Server与服务器之间的SQL请求问题Visual Studio Web开发.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆