Hi i am trying to create an insertion form in ASP.net. but i get this exception and i could not find this with google.
嗨,我想在ASP.net中创建一个插入表单。但我得到这个例外,我无法用谷歌找到这个。
what am i doing wrong ?
我究竟做错了什么 ?
here is my code:
这是我的代码:
<div id = "survey_div">
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:surveyConnectionString1 %>"
DeleteCommand="DELETE FROM survey"
InsertCommand="INSERT INTO survey(age, country, city) VALUES (,,)"
SelectCommand="SELECT FROM survey" UpdateCommand="UPDATE survey SET">
</asp:SqlDataSource>
<asp:DetailsView ID="DetailsView1" runat="server" CellPadding="4"
DataSourceID="SqlDataSource1" EnableModelValidation="True" ForeColor="#333333"
GridLines="None" Height="50px" Width="125px">
<AlternatingRowStyle BackColor="White" />
<CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
<EditRowStyle BackColor="#2461BF" />
<FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
<Fields>
<asp:CommandField ShowInsertButton="True" />
</Fields>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#EFF3FB" />
</asp:DetailsView>
</div>
2 个解决方案
#1
5
It looks like it's your SelectCommand
, you need to either have a list of columns, or *
between Select
and From
(preferably a list of columns).
它看起来像是你的SelectCommand,你需要有一个列列表,或者在Select和From之间有*(最好是列列表)。
#2
1
It looks like the SelectCommand
in your SqlDataSource
is not specifying any columns to select:
看起来SqlDataSource中的SelectCommand没有指定要选择的任何列:
SELECT FROM survey
#1
5
It looks like it's your SelectCommand
, you need to either have a list of columns, or *
between Select
and From
(preferably a list of columns).
它看起来像是你的SelectCommand,你需要有一个列列表,或者在Select和From之间有*(最好是列列表)。
#2
1
It looks like the SelectCommand
in your SqlDataSource
is not specifying any columns to select:
看起来SqlDataSource中的SelectCommand没有指定要选择的任何列:
SELECT FROM survey