but it gives error message "Syntax error in query expression 'SELECT sum(marks) FROM data'."
Do you have any idea of this,Is my Sql Query has error..??
my code is like follow
private void button1_Click(object sender, EventArgs e)
{
OleDbConnection myConnection = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;" + @"data source=new.accdb");
myConnection.Open();
OleDbCommand myCommand = new OleDbCommand();
myCommand.Connection = myConnection;
myCommand.CommandText = "CREATE TABLE wkall([Sum1] double)";
myCommand.ExecuteNonQuery();
MessageBox.Show("Table Created Successfully");
OleDbCommand myCommand1 = new OleDbCommand();
myCommand1.Connection = myConnection;
myCommand1.CommandText = "INSERT INTO wkall(Sum1) VALUES(SELECT sum(marks) FROM data)";
myCommand1.ExecuteNonQuery();
MessageBox.Show("Data Inserted Successfully");
}
data table id following format
Name(text) marks(double)

New Topic/Question
Reply



MultiQuote




|