none
System.Data.SqlClient.sqlException:'incorrect syntax near 'values;. RRS feed

  • Question

  • I want to insert data but it shows me this error.

    System.Data.SqlClient.sqlException:'incorrect syntax near 'values;. 

    <td class="auto-style3">&nbsp;</td>
                        <td class="auto-style5">
                            <asp:Button ID="btnReq" runat="server" OnClick="btnReq_Click" Text="Add User" />
                            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NewsConnectionString %>" InsertCommand="insert into Users valuse(@username, @password, @email)" SelectCommand="SELECT * FROM [Users]">
                                <InsertParameters>
                                    <asp:ControlParameter ControlID="txtUN" Name="username" PropertyName="Text" />
                                    <asp:ControlParameter ControlID="txtPW" Name="password" PropertyName="Text" />
                                    <asp:ControlParameter ControlID="txtEM" Name="email" PropertyName="Text" />
                                </InsertParameters>
                            </asp:SqlDataSource>
                        </td>
                        <td>&nbsp;</td>

    Wednesday, February 20, 2019 4:54 AM

All replies

  • There is one typo clear in your query i.e.  valuse  it is is values  actually. Try changing that and see.

    [If a post helps to resolve your issue, please click the "Mark as Answer" of that post or click Answered "Vote as helpful" button of that post. By marking a post as Answered or Helpful, you help others find the answer faster. ]


    Blog | LinkedIn | Stack Overflow | Facebook
    profile for Ehsan Sajjad on Stack Exchange, a network of free, community-driven Q&A sites

    Wednesday, February 20, 2019 5:00 AM
  • Hi Atify,

    Thank you for posting here.

    According your post, your question is more relevant to the asp.net, please post in the following forum.

    https://forums.asp.net/18.aspx/1?Web+Forms

    The Visual C# forum discuss and ask questions about the C# programming language, IDE, libraries, samples, and tools.

    Best regards,

    Jack 


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, February 20, 2019 7:57 AM