C#は初めてです。手伝ってください!
MS Access でデータベースに値を挿入しようとするとエラーが発生する エラー メッセージは次のとおりです。
以下は私のコードです:
using 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 AzureSecureStore
{
public partial class Client : Form
{
OleDbConnection vcon = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\SB18\Documents\Visual Studio 2010\Projects\AzureSecureStore\AzureSecureStore\AzcureSecureStore Database.accdb");
public Client()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void button5_Click(object sender, EventArgs e)
{
}
private void button4_Click(object sender, EventArgs e)
{
}
private void Client_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'azcureSecureStore_DatabaseDataSet5.Client' table. You can move, or remove it, as needed.
this.clientTableAdapter.Fill(this.azcureSecureStore_DatabaseDataSet5.Client);
// TODO: This line of code loads data into the 'azcureSecureStore_DatabaseDataSet2.Client' table. You can move, or remove it, as needed.
//this.clientTableAdapter.Fill(this.azcureSecureStore_DatabaseDataSet2.Client);
}
private void button2_Click(object sender, EventArgs e)
{
string ab = string.Format("insert into Client values({0}, '{1}', '{2}', {3}, {4}, '{5}', {6})", textBox1.Text, textBox2.Text, int.Parse(textBox3.Text), int.Parse(textBox4.Text), textBox9.Text, int.Parse(textBox10.Text));
OleDbCommand vcom = new OleDbCommand(ab, vcon);
vcom.ExecuteNonQuery();
MessageBox.Show("Data stored successfully");
vcom.Dispose();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
}
}