|
Dobrý den, chtěl bych se zeptat kde můžu mít asi chybu pokud m při odeslání níže uvedeného formuláře vyskočí tato chyba:
Server Error in '/11.12.2012' Application.
--------------------------------------------------------------------------------
Incorrect syntax near 'nvarchar'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near 'nvarchar'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): Incorrect syntax near 'nvarchar'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +2073486
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5064444
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2275
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +215
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +987
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +178
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +137
System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) +394
System.Web.UI.WebControls.SqlDataSourceView.ExecuteInsert(IDictionary values) +407
System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback) +89
System.Web.UI.WebControls.FormView.HandleInsert(String commandArg, Boolean causesValidation) +377
System.Web.UI.WebControls.FormView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +612
System.Web.UI.WebControls.FormView.OnBubbleEvent(Object source, EventArgs e) +95
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.FormViewRow.OnBubbleEvent(Object source, EventArgs e) +112
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +125
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +167
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
A tady přikládám můj kód:
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="NovyHrac.aspx.cs" Inherits="NovyHrac" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:TJTUPESYConnectionString3_This %>"
DeleteCommand="DELETE FROM [Hraci] WHERE [Jmeno] = @Jmeno"
InsertCommand="INSERT INTO [Hraci] ([Jmeno], [Prijimeni], [IDKategorie], [Narozeni], [Cislo dresu], [FotbalovyVzor], [OblibenyKlub], [Konicky], [OblibenyPredmet], [OblibeneJidlo], [KontaktRodice]) VALUES (@Jmeno, @Prijimeni, @IDKategorie, @Narozeni, @Cislo_dresu, @FotbalovyVzor, @OblibenyKlub, @Konicky, @OblibenyPredmet, @OblibeneJidlo, @KontaktRodice)"
SelectCommand="SELECT * FROM [Hraci] WHERE ([ID_Hrace] = @ID_Hrace)"
UpdateCommand="UPDATE [Hraci] SET [Prijimeni] = @Prijimeni, [IDKategorie] = @IDKategorie, [Narozeni] = @Narozeni, [Cislo dresu] = @Cislo_dresu, [ID_Hrace] = @ID_Hrace, [FotbalovyVzor] = @FotbalovyVzor, [OblibenyKlub] = @OblibenyKlub, [Konicky] = @Konicky, [OblibenyPredmet] = @OblibenyPredmet, [OblibeneJidlo] = @OblibeneJidlo, [KontaktRodice] = @KontaktRodice WHERE [Jmeno] = @Jmeno">
<DeleteParameters>
<asp:Parameter Name="Jmeno" Type="String" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="Jmeno" Type="String" />
<asp:Parameter Name="Prijimeni" Type="String" />
<asp:Parameter Name="IDKategorie" Type="Int32" />
<asp:Parameter DbType="Date" Name="Narozeni" />
<asp:Parameter Name="Cislo_dresu" Type="Int32" />
<asp:Parameter Name="FotbalovyVzor" Type="String" />
<asp:Parameter Name="OblibenyKlub" Type="String" />
<asp:Parameter Name="Konicky" Type="String" />
<asp:Parameter Name="OblibenyPredmet" Type="String" />
<asp:Parameter Name="OblibeneJidlo" Type="String" />
<asp:Parameter Name="KontaktRodice" Type="Int32" />
</InsertParameters>
<SelectParameters>
<asp:QueryStringParameter Name="ID_Hrace" QueryStringField="id" Type="Int32" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="Prijimeni" Type="String" />
<asp:Parameter Name="IDKategorie" Type="Int32" />
<asp:Parameter DbType="Date" Name="Narozeni" />
<asp:Parameter Name="Cislo_dresu" Type="Int32" />
<asp:Parameter Name="ID_Hrace" Type="Int32" />
<asp:Parameter Name="FotbalovyVzor" Type="String" />
<asp:Parameter Name="OblibenyKlub" Type="String" />
<asp:Parameter Name="Konicky" Type="String" />
<asp:Parameter Name="OblibenyPredmet" Type="String" />
<asp:Parameter Name="OblibeneJidlo" Type="String" />
<asp:Parameter Name="KontaktRodice" Type="Int32" />
<asp:Parameter Name="Jmeno" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>
<asp:FormView ID="FormView1" runat="server" DefaultMode="Insert" DataKeyNames="Jmeno"
DataSourceID="SqlDataSource1">
<EditItemTemplate>
Jmeno:
<asp:Label ID="JmenoLabel1" runat="server" Text='<%# Eval("Jmeno") %>' />
<br />
Prijimeni:
<asp:TextBox ID="PrijimeniTextBox" runat="server"
Text='<%# Bind("Prijimeni") %>' />
<br />
IDKategorie:
<asp:TextBox ID="IDKategorieTextBox" runat="server"
Text='<%# Bind("IDKategorie") %>' />
<br />
Narozeni:
<asp:TextBox ID="NarozeniTextBox" runat="server"
Text='<%# Bind("Narozeni") %>' />
<br />
Cislo dresu:
<asp:TextBox ID="Cislo_dresuTextBox" runat="server"
Text='<%# Bind("[Cislo dresu]") %>' />
<br />
ID_Hrace:
<asp:Label ID="ID_HraceLabel1" runat="server" Text='<%# Eval("ID_Hrace") %>' />
<br />
FotbalovyVzor:
<asp:TextBox ID="FotbalovyVzorTextBox" runat="server"
Text='<%# Bind("FotbalovyVzor") %>' />
<br />
OblibenyKlub:
<asp:TextBox ID="OblibenyKlubTextBox" runat="server"
Text='<%# Bind("OblibenyKlub") %>' />
<br />
Konicky:
<asp:TextBox ID="KonickyTextBox" runat="server" Text='<%# Bind("Konicky") %>' />
<br />
OblibenyPredmet:
<asp:TextBox ID="OblibenyPredmetTextBox" runat="server"
Text='<%# Bind("OblibenyPredmet") %>' />
<br />
OblibeneJidlo:
<asp:TextBox ID="OblibeneJidloTextBox" runat="server"
Text='<%# Bind("OblibeneJidlo") %>' />
<br />
KontaktRodice:
<asp:TextBox ID="KontaktRodiceTextBox" runat="server"
Text='<%# Bind("KontaktRodice") %>' />
<br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True"
CommandName="Update" Text="Update" />
<asp:LinkButton ID="UpdateCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
<InsertItemTemplate>
<table>
<tr>
<td>Jméno:</td>
<td>
<asp:TextBox ID="JmenoTextBox" runat="server" Text='<%# Bind("Jmeno") %>' />
</td>
</tr>
<tr>
<td>Příjmení:</td>
<td>
<asp:TextBox ID="PrijimeniTextBox" runat="server" Text='<%# Bind("Prijimeni") %>' />
</td>
</tr>
<tr>
<td>IDKategorie:</td>
<td>
<asp:TextBox ID="IDKategorieTextBox" runat="server" Text='<%# Bind("IDKategorie") %>' />
</td>
</tr>
<tr>
<td>Narození:</td>
<td>
<asp:TextBox ID="NarozeniTextBox" runat="server" Text='<%# Bind("Narozeni") %>' />
</td>
</tr>
<tr>
<td>Číslo dresu:</td>
<td>
<asp:TextBox ID="Cislo_dresuTextBox" runat="server" Text='<%# Bind("[Cislo dresu]") %>' />
</td>
</tr>
<tr>
<td>ID Hráče:</td>
<td>
<asp:TextBox ID="ID_HRACETextBox" runat="server" Text='<%# Eval("ID_Hrace") %>' />
</td>
</tr>
<tr>
<td>Fotbalový vzor:</td>
<td>
<asp:TextBox ID="FotbalovyVzorTextBox" runat="server" Text='<%# Bind("FotbalovyVzor") %>' />
</td>
</tr>
<tr>
<td>Oblíbený klub:</td>
<td>
<asp:TextBox ID="OblibenyKlubTextBox" runat="server" Text='<%# Bind("OblibenyKlub") %>' />
</td>
</tr>
<tr>
<td>Koníčky:</td>
<td>
<asp:TextBox ID="KonickyTextBox" runat="server" Text='<%# Bind("Konicky") %>' />
</td>
</tr>
<tr>
<td>Oblíbený předmět:</td>
<td>
<asp:TextBox ID="OblibenyPredmetTextBox" runat="server" Text='<%# Bind("OblibenyPredmet") %>' />
</td>
</tr>
<tr>
<td>Oblíbené jídlo:</td>
<td>
<asp:TextBox ID="OblibeneJidloTextBox" runat="server" Text='<%# Bind("OblibeneJidlo") %>' />
</td>
</tr>
<tr>
<td>Kontakt na Rodiče:</td>
<td>
<asp:TextBox ID="KontaktRodiceTextBox" runat="server" Text='<%# Bind("KontaktRodice") %>' />
</td>
</tr>
</table>
<asp:Button ID="InsertButton" runat="server" CausesValidation="True"
CommandName="Insert" Text="Přidat hráče" />
<asp:Button ID="InsertCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Zrušit" />
</InsertItemTemplate>
<ItemTemplate>
Jmeno:
<asp:Label ID="JmenoLabel" runat="server" Text='<%# Eval("Jmeno") %>' />
<br />
Prijimeni:
<asp:Label ID="PrijimeniLabel" runat="server" Text='<%# Bind("Prijimeni") %>' />
<br />
IDKategorie:
<asp:Label ID="IDKategorieLabel" runat="server"
Text='<%# Bind("IDKategorie") %>' />
<br />
Narozeni:
<asp:Label ID="NarozeniLabel" runat="server" Text='<%# Bind("Narozeni") %>' />
<br />
Cislo dresu:
<asp:Label ID="Cislo_dresuLabel" runat="server"
Text='<%# Bind("[Cislo dresu]") %>' />
<br />
ID_Hrace:
<asp:Label ID="ID_HraceLabel" runat="server" Text='<%# Eval("ID_Hrace") %>' />
<br />
FotbalovyVzor:
<asp:Label ID="FotbalovyVzorLabel" runat="server"
Text='<%# Bind("FotbalovyVzor") %>' />
<br />
OblibenyKlub:
<asp:Label ID="OblibenyKlubLabel" runat="server"
Text='<%# Bind("OblibenyKlub") %>' />
<br />
Konicky:
<asp:Label ID="KonickyLabel" runat="server" Text='<%# Bind("Konicky") %>' />
<br />
OblibenyPredmet:
<asp:Label ID="OblibenyPredmetLabel" runat="server"
Text='<%# Bind("OblibenyPredmet") %>' />
<br />
OblibeneJidlo:
<asp:Label ID="OblibeneJidloLabel" runat="server"
Text='<%# Bind("OblibeneJidlo") %>' />
<br />
KontaktRodice:
<asp:Label ID="KontaktRodiceLabel" runat="server"
Text='<%# Bind("KontaktRodice") %>' />
<br />
</ItemTemplate>
</asp:FormView>
</asp:Content>
Chyba bude URČITĚ někde v části <InsertItemTemplate>, ale nevím kde...:(
|