Question the textbox TextBox_Titre doesn't exist in this context

kryptong

New member
Joined
Dec 23, 2012
Messages
1
Programming Experience
Beginner
Hello guys ,
I made a web app , and I wanted to connect it with access database , but when I got in error telling me that TextBox_Titre doesn't exist in this context, though it does !!
Here is my code
Default.aspx
C#:
[COLOR=#000000][FONT=Consolas]<%[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"  Theme="MonApparence" %>[/FONT][/COLOR]
C#:
[COLOR=purple]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#A31515]<script[/COLOR][COLOR=red]runat[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"server"[/COLOR][COLOR=#A31515]>[/COLOR][COLOR=#000000]

[/COLOR][COLOR=#A31515]</script>[/COLOR][COLOR=#000000]

[/COLOR][COLOR=#A31515]<html[/COLOR][COLOR=#A31515]>[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#A31515]<head[/COLOR][COLOR=red]id[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Head1"[/COLOR][COLOR=red]runat[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"server"[/COLOR][COLOR=#A31515]>[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#A31515]<title>[/COLOR][COLOR=#000000]Gestion des thèmes avec ASP.NET 2.0 et C#[/COLOR][COLOR=#A31515]</title>[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#A31515]</head>[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#A31515]<body>[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#A31515]<form[/COLOR][COLOR=red]id[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"form1"[/COLOR][COLOR=red]runat[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"server"[/COLOR][COLOR=#A31515]>[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#A31515]<div[/COLOR][COLOR=red]class[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"centre"[/COLOR][COLOR=#A31515]>[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#A31515]<table[/COLOR][COLOR=red]width[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"350px"[/COLOR][COLOR=#A31515]>[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#A31515]<tr>[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#A31515]<td[/COLOR][COLOR=red]colspan[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"2"[/COLOR][COLOR=#A31515]>[/COLOR][COLOR=#000000]
            [/COLOR][COLOR=#A31515]<asp:Image[/COLOR][COLOR=red]ID[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Image_Fleche"[/COLOR][COLOR=red]SkinID[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Fleche"[/COLOR][COLOR=red]runat[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"server"[/COLOR][COLOR=#A31515]/>[/COLOR][COLOR=#000000] 
            [/COLOR][COLOR=#A31515]<asp:Label[/COLOR][COLOR=red]ID[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Label_Title"[/COLOR][COLOR=red]SkinID[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Title"[/COLOR][COLOR=red]runat[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"server"[/COLOR][COLOR=red]Text[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Formulaire d'ajout d'un nouveau livre"[/COLOR][COLOR=#A31515]></asp:Label>[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#A31515]</td>[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#A31515]</tr>[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#A31515]<tr>[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#A31515]<td[/COLOR][COLOR=red]style[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"[/COLOR][COLOR=#0000FF]width[/COLOR][COLOR=#000000]:[/COLOR][COLOR=red]100px[/COLOR][COLOR=#000000];[/COLOR][COLOR=#0000FF]"[/COLOR][COLOR=#A31515]><asp:Label[/COLOR][COLOR=red]ID[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Label_Titre"[/COLOR][COLOR=red]runat[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"server"[/COLOR][COLOR=red]Text[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Titre "[/COLOR][COLOR=#A31515]></asp:Label></td>[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#A31515]<td[/COLOR][COLOR=red]style[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"[/COLOR][COLOR=#0000FF]width[/COLOR][COLOR=#000000]:[/COLOR][COLOR=red]250px[/COLOR][COLOR=#000000];[/COLOR][COLOR=#0000FF]"[/COLOR][COLOR=#A31515]><asp:TextBox[/COLOR][COLOR=red]ID[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"TextBox_Titre"[/COLOR][COLOR=red]runat[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"server"[/COLOR][COLOR=#A31515]></asp:TextBox></td>[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#A31515]</tr>[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#A31515]<tr>[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#A31515]<td><asp:Label[/COLOR][COLOR=red]ID[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Label_Auteur"[/COLOR][COLOR=red]runat[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"server"[/COLOR][COLOR=red]Text[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Auteur "[/COLOR][COLOR=#A31515]></asp:Label></td>[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#A31515]<td><asp:TextBox[/COLOR][COLOR=red]ID[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"TextBox_Auteur"[/COLOR][COLOR=red]runat[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"server"[/COLOR][COLOR=#A31515]></asp:TextBox></td>[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#A31515]</tr>[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#A31515]<tr>[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#A31515]<td><asp:Label[/COLOR][COLOR=red]ID[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Label_Catégorie"[/COLOR][COLOR=red]runat[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"server"[/COLOR][COLOR=red]Text[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Catégorie "[/COLOR][COLOR=#A31515]></asp:Label></td>[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#A31515]<td><asp:TextBox[/COLOR][COLOR=red]ID[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"TextBox_Catégorie"[/COLOR][COLOR=red]runat[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"server"[/COLOR][COLOR=#A31515]></asp:TextBox></td>[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#A31515]</tr>[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#A31515]<tr>[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#A31515]<td><asp:Label[/COLOR][COLOR=red]ID[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Label_Collection"[/COLOR][COLOR=red]runat[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"server"[/COLOR][COLOR=red]Text[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Collection "[/COLOR][COLOR=#A31515]></asp:Label></td>[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#A31515]<td><asp:TextBox[/COLOR][COLOR=red]ID[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"TextBox_Collection"[/COLOR][COLOR=red]runat[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"server"[/COLOR][COLOR=#A31515]></asp:TextBox></td>[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#A31515]</tr>[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#A31515]<tr>[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#A31515]<td><asp:Label[/COLOR][COLOR=red]ID[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Label_Langue"[/COLOR][COLOR=red]runat[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"server"[/COLOR][COLOR=red]Text[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Langue"[/COLOR][COLOR=#A31515]></asp:Label></td>[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#A31515]<td><asp:TextBox[/COLOR][COLOR=red]ID[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"TextBox_Langue"[/COLOR][COLOR=red]runat[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"server"[/COLOR][COLOR=#A31515]></asp:TextBox></td>[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#A31515]</tr>[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#A31515]<tr>[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#A31515]<td><asp:Label[/COLOR][COLOR=red]ID[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Label_Editeur"[/COLOR][COLOR=red]runat[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"server"[/COLOR][COLOR=red]Text[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Editeur"[/COLOR][COLOR=#A31515]></asp:Label></td>[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#A31515]<td><asp:TextBox[/COLOR][COLOR=red]ID[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"TextBox_Editeur"[/COLOR][COLOR=red]runat[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"server"[/COLOR][COLOR=#A31515]></asp:TextBox></td>[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#A31515]</tr>[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#A31515]<tr>[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#A31515]<td[/COLOR][COLOR=red]colspan[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"2"[/COLOR][COLOR=red]style[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"[/COLOR][COLOR=#0000FF]text-align[/COLOR][COLOR=#000000]:[/COLOR][COLOR=#000000] center[/COLOR][COLOR=#000000];[/COLOR][COLOR=#0000FF]"[/COLOR][COLOR=#A31515]>[/COLOR][COLOR=#000000]
            [/COLOR][COLOR=#A31515]<br[/COLOR][COLOR=#A31515]/>[/COLOR][COLOR=#000000]
            [/COLOR][COLOR=#A31515]<asp:Button[/COLOR][COLOR=red]ID[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Button_Valider"[/COLOR][COLOR=red]runat[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"server"[/COLOR][COLOR=red]Text[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Valider"[/COLOR][COLOR=red]OnClick[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"[/COLOR][COLOR=#2B91AF]Button_Valider_Click[/COLOR][COLOR=#0000FF]"[/COLOR][COLOR=red]Width[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"60px"[/COLOR][COLOR=#A31515]/>[/COLOR][COLOR=#000000] 
                        [/COLOR][COLOR=#A31515]<asp:Button[/COLOR][COLOR=red]ID[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Button_Annuler"[/COLOR][COLOR=red]runat[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"server"[/COLOR][COLOR=red]Text[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"Annuler"[/COLOR][COLOR=red]OnClick[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]"[/COLOR][COLOR=#2B91AF]Button_Annuler_Click[/COLOR][COLOR=#0000FF]"[/COLOR][COLOR=#A31515]/>[/COLOR][COLOR=#000000] 
             
            [/COLOR][COLOR=#A31515]</td>[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#A31515]</tr>[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#A31515]</table>[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#A31515]</div>[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#A31515]</form>[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#A31515]</body>[/COLOR][COLOR=#000000]
[/COLOR][FONT=Segoe UI][COLOR=#A31515][FONT=Consolas]</html>[/FONT][/COLOR][/FONT]

Default.aspx.cs
C#:
[COLOR=#0000FF][FONT=Consolas]using[/FONT][/COLOR][COLOR=#2B91AF][FONT=Consolas]System[/FONT][/COLOR][COLOR=#000000][FONT=Consolas];[/FONT][/COLOR]
C#:
[COLOR=#0000FF]using[/COLOR][COLOR=#2B91AF]System[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Collections[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Generic[/COLOR][COLOR=#000000];[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#0000FF]using[/COLOR][COLOR=#2B91AF]System[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Linq[/COLOR][COLOR=#000000];[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#0000FF]using[/COLOR][COLOR=#2B91AF]System[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Web[/COLOR][COLOR=#000000];[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#0000FF]using[/COLOR][COLOR=#2B91AF]System[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Web[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]UI[/COLOR][COLOR=#000000];[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#0000FF]using[/COLOR][COLOR=#2B91AF]System[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Web[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]UI[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]WebControls[/COLOR][COLOR=#000000];[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#0000FF]using[/COLOR][COLOR=#2B91AF]System[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Data[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]OleDb[/COLOR][COLOR=#000000];[/COLOR][COLOR=#000000]

[/COLOR][COLOR=#0000FF]namespace[/COLOR][COLOR=#2B91AF]WebApplication1[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#000000]{[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#0000FF]public[/COLOR][COLOR=#0000FF]partial[/COLOR][COLOR=#0000FF]class[/COLOR][COLOR=#000000] _default  [/COLOR][COLOR=#000000]:[/COLOR][COLOR=#2B91AF]System[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Web[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]UI[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Page[/COLOR][COLOR=#000000]
    [/COLOR][COLOR=#000000]{[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#2B91AF]OleDbConnection[/COLOR][COLOR=#000000] con [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]new[/COLOR][COLOR=#2B91AF]OleDbConnection[/COLOR][COLOR=#000000](@[/COLOR][COLOR=#A31515]"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\USER\Documents\Visual Studio 2012\Projects\WebApplication1\livre.accdb"[/COLOR][COLOR=#000000]);[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#0000FF]protected[/COLOR][COLOR=#0000FF]void[/COLOR][COLOR=#2B91AF]Page_Load[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]object[/COLOR][COLOR=#000000] sender[/COLOR][COLOR=#000000],[/COLOR][COLOR=#2B91AF]EventArgs[/COLOR][COLOR=#000000] e[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#000000]{[/COLOR][COLOR=#000000]
            con[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Open[/COLOR][COLOR=#000000]();[/COLOR][COLOR=#000000]
     
        [/COLOR][COLOR=#000000]}[/COLOR][COLOR=#000000]

        
        [/COLOR][COLOR=#0000FF]protected[/COLOR][COLOR=#0000FF]void[/COLOR][COLOR=#2B91AF]Button_Valider_Click[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]object[/COLOR][COLOR=#000000] sender[/COLOR][COLOR=#000000],[/COLOR][COLOR=#2B91AF]EventArgs[/COLOR][COLOR=#000000] e[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#000000]{[/COLOR][COLOR=#000000]
            [/COLOR][COLOR=#0000FF]string[/COLOR][COLOR=#000000] vaq1 [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#0000FF]string[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Format[/COLOR][COLOR=#000000]([/COLOR][COLOR=#A31515]"insert into livre values((0)"[/COLOR][COLOR=#000000],[/COLOR][COLOR=#2B91AF]TextBox_Titre[/COLOR][COLOR=#000000]);[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#000000]}[/COLOR][COLOR=#000000]
    
    
    
    
    
    [/COLOR][COLOR=#000000]}[/COLOR][COLOR=#000000]

   
[/COLOR][FONT=Segoe UI][COLOR=#000000][FONT=Consolas]}[/FONT][/COLOR][/FONT]

 
The given code that you've posted here works for me, though it looks like your String.Format() part is incomplete still.
I would also recommend using the |DataDirectory| for the database and not that long path for the connection string, just my 2 cents.
 
Back
Top Bottom