Mot-clé non pris en charge: 'fournisseur'

Je vais Avoir cette erreur:

Mot-clé non pris en charge: 'fournisseur'.

Description: Une exception non gérée s'est produite pendant l'exécution de la demande web actuelle. Veuillez consulter la trace de la pile pour plus d'informations sur l'erreur et où elle a son origine dans le code.

Détails De L'Exception: System.ArgumentException: le mot-Clé non pris en charge: 'fournisseur'.

Source De L'Erreur:

Line 24:     {
Line 25:         Session["id"] = e.CommandArgument.ToString();
Line 26:         SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
Line 27:            con.Open();
Line 28:             SqlCommand cmd1 = new SqlCommand("INSERT INTO tb2 (id, name) SELECT id, name FROM tb1 where id='"+Session["id"].ToString()+"'", con);

Source File: c:\inetpub\wwwroot\logon\page.aspx    Line: 26 

Voici mon code complet:

<%@ Page Language="C#" Debug="true" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace = "System.Data.SqlClient" %>
<script runat="server" type="css">
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bind();
}
}
protected void bind()
{
PendingRecordsGridview.DataSourceID = "";
PendingRecordsGridview.DataSource = sd1;
PendingRecordsGridview.DataBind();
}
protected void PendingRecordsGridview_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "accept")
{
Session["id"] = e.CommandArgument.ToString();
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
con.Open();
SqlCommand cmd1 = new SqlCommand("INSERT INTO tb2 (id, name) SELECT id, name FROM tb1 where id='"+Session["id"].ToString()+"'", con);
SqlCommand cmd2 = new SqlCommand("delete from tb1 where id='"+Session["id"].ToString()+"'", con);
cmd1.ExecuteNonQuery();
cmd2.ExecuteNonQuery();
bind();
}
}
</script>
<form id="form1" runat="server">
<asp:GridView ID="PendingRecordsGridview" runat="server" AutoGenerateColumns="False" DataKeyNames="id" onrowcommand="PendingRecordsGridview_RowCommand" DataSourceID="sd1">
<Columns>
<asp:templatefield HeaderText="Accept">
<ItemTemplate>
<asp:Button CommandArgument='<%# Bind("id") %>' ID="Button1" runat="server" CausesValidation="false" CommandName="accept" Text="Accept" />
</ItemTemplate>
</asp:templatefield>
<asp:templatefield HeaderText="name" SortExpression="name">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("name") %>'>
</asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("name") %>'>
</asp:Label>
</ItemTemplate>
</asp:templatefield>
<asp:templatefield HeaderText="id" SortExpression="id">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("id") %>'>
</asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("id") %>'>
</asp:Label>
</ItemTemplate>
</asp:templatefield>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="sd1" runat="server" 
ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
SelectCommand="SELECT * FROM [tb1]" DeleteCommand="DELETE FROM [tb1] WHERE [id] = ?" InsertCommand="INSERT INTO [tb1] ([name]) VALUES (?)"  UpdateCommand="UPDATE [tb1] SET [name] = ? WHERE [id] = ?">
<DeleteParameters>
<asp:parameter Name="id" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:parameter Name="name" Type="String" />
<asp:parameter Name="id" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:parameter Name="name" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</form>       

Web.config

<configuration>
<connectionStrings>
<add name="ConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\inetpub\wwwroot\logon\_private\db1.mdb"
providerName="System.Data.OleDb" />
</connectionStrings>
</configuration>

S'il vous plaît aider! Merci!!!!

Pourriez-vous montrer des pièces du web.config qui a la propriété connectionstring?
Avec la concaténation de chaîne comme ça, votre code est ouvert à Injection SQL.
n'a pas d'importance ... d'un site web.config sera généré. Vous êtes même à s'y référer dans votre code "configurationManager.ConnectionString"
Eh bien, où est-ce que votre chaîne de connexion viennent ensuite? Je crois que c'est ce que @scartag est à la recherche d' (le véritable chaîne de connexion).
vérifier le dossier de projet.

OriginalL'auteur Peterson Pilares | 2013-01-06