Click here to Skip to main content
15,896,111 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# .NET Windows Media Player WM_COPYDATA *whimper* Pin
spamoom28-Dec-08 2:04
spamoom28-Dec-08 2:04 
Question[Message Deleted] Pin
TwoSocks27-Dec-08 13:40
TwoSocks27-Dec-08 13:40 
Questionlock the windows xp Pin
abu rakan27-Dec-08 12:06
abu rakan27-Dec-08 12:06 
AnswerRe: lock the windows xp Pin
User 665827-Dec-08 13:00
User 665827-Dec-08 13:00 
Questionavi file Pin
manishkumarcse27-Dec-08 11:57
manishkumarcse27-Dec-08 11:57 
GeneralRe: avi file Pin
Luc Pattyn27-Dec-08 12:38
sitebuilderLuc Pattyn27-Dec-08 12:38 
AnswerRe: avi file Pin
Code Soldier28-Dec-08 5:25
Code Soldier28-Dec-08 5:25 
QuestionDatabase update error help Pin
hatan8627-Dec-08 9:39
hatan8627-Dec-08 9:39 
I'm trying to write a questionnaire that gathers info of the user and then updates a database in Access. I've managed to write the program and everything works up to the point where it updates the database, at which point it displays the error message below:

OleDbException was unhandled
Syntax error in INSERT INTO statement

I've checked it and I can't find any syntax errors in it. Could someone help me out please? I'm very new to programming, so please try to explain in as simple terms as possible. The section of code is below. Thanks for your help.

sing System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;

namespace WindowsFormsApplication5
{
    public partial class Form1 : Form
    {
        OleDbConnection con = new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=d:\\LO2.mdb");
        OleDbDataAdapter ad;

        DataTable table = new DataTable();
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            ad = new OleDbDataAdapter("select * from attributes ", con);
            OleDbCommandBuilder cb = new OleDbCommandBuilder(ad);
            ad.Fill(table);

            dataGridView1.DataSource = table;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            // insert
            DataRow row = table.NewRow();
            row["identifier"] = textBox1.Text;
            row["language"] = textBox2.Text;
            row["title"] = textBox3.Text;
            row["description"] = textBox4.Text;
            row["id"] = textBox5.Text;
            table.Rows.Add(row);

            ad.Update(table); // error it's here

            dataGridView1.DataSource = table;
        }

AnswerRe: Database update error help Pin
Colin Angus Mackay27-Dec-08 9:57
Colin Angus Mackay27-Dec-08 9:57 
GeneralRe: Database update error help Pin
hatan8627-Dec-08 10:18
hatan8627-Dec-08 10:18 
GeneralRe: Database update error help Pin
Colin Angus Mackay27-Dec-08 10:38
Colin Angus Mackay27-Dec-08 10:38 
QuestionPaint drawing multiple layers Pin
Chris Copeland27-Dec-08 5:48
mveChris Copeland27-Dec-08 5:48 
Questiontablelayoutpanel into usercontrol Pin
Michael Yip27-Dec-08 4:27
Michael Yip27-Dec-08 4:27 
QuestionImage plotting problem Pin
Silvyster27-Dec-08 3:48
Silvyster27-Dec-08 3:48 
AnswerRe: Image plotting problem Pin
User 665827-Dec-08 3:59
User 665827-Dec-08 3:59 
Questionfetching unknown values from the database Pin
nishu00727-Dec-08 2:52
professionalnishu00727-Dec-08 2:52 
AnswerRe: fetching unknown values from the database Pin
Wendelius27-Dec-08 3:55
mentorWendelius27-Dec-08 3:55 
Questionhow to edit @ of legend using crystalreports with vs2008 Pin
vishnukamath27-Dec-08 2:30
vishnukamath27-Dec-08 2:30 
QuestionMicrosoft Web Browser - no scroll bars and no right click? Pin
aleXXXka27-Dec-08 1:26
aleXXXka27-Dec-08 1:26 
AnswerRe: Microsoft Web Browser - no scroll bars and no right click? Pin
spamoom28-Dec-08 0:25
spamoom28-Dec-08 0:25 
GeneralRe: Microsoft Web Browser - no scroll bars and no right click? Pin
aleXXXka28-Dec-08 3:53
aleXXXka28-Dec-08 3:53 
AnswerRe: Microsoft Web Browser - no scroll bars and no right click? Pin
spamoom28-Dec-08 5:32
spamoom28-Dec-08 5:32 
GeneralRe: Microsoft Web Browser - no scroll bars and no right click? Pin
aleXXXka28-Dec-08 7:18
aleXXXka28-Dec-08 7:18 
Questiondatagridview using c# Pin
kulandaivel_mca200726-Dec-08 22:47
kulandaivel_mca200726-Dec-08 22:47 
AnswerRe: datagridview using c# Pin
Brij26-Dec-08 23:34
mentorBrij26-Dec-08 23:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.