Hi I'm writing this code in order to save datas from my form to my access database. Here is the code
But when I debug, there's an error " The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. "
Any help please? Thank you!
Code:
[SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]
OleDbConnection[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] connection;
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]string[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] connectionString = [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\PATS\\PATS.mdb"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]string[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] commandString = [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"INSERT INTO RegisteredUserParticulars (WindowsUserName, FullName, AdminNumber, ProjectYear, ProjectPath, SupervisorName, ProjectStartDate, ProjectEndDate)VALUES(?, ?, ?, ?, ?, ?, ?, ?)"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
connection = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]OleDbConnection[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](connectionString);
[/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]OleDbCommand[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] command = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]OleDbCommand[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](commandString, connection);
connection.Open();
command.Parameters.AddWithValue([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"?"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], lbl1Trial3.Text);
command.Parameters.AddWithValue([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"?"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], lbl2Trial3.Text);
command.Parameters.AddWithValue([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"?"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], lbl3Trial3.Text);
command.Parameters.AddWithValue([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"?"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], lbl4Trial3.Text);
command.Parameters.AddWithValue([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"?"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], lbl5Trial3.Text);
command.Parameters.AddWithValue([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"?"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], lbl6Trial3.Text);
command.Parameters.AddWithValue([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"?"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], lblStartdate.Text);
command.Parameters.AddWithValue([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"?"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], lblEndDate.Text);
command.ExecuteNonQuery();
connection.Close();
[/SIZE]
But when I debug, there's an error " The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. "
Any help please? Thank you!