我正在尝试执行插入但收到此错误:[异常:处理命令期间发生一个或多个错误。ORA-00936: 缺少表达式]
它适用于选择查询。
table structure is as follow
database-oracle 10g
table name-investor_info
investor_id-number
first_name-varchar
lastname-varchar
age-number
location-varchar
contact_number-varchar
email-varchar
checked-number-number
public void insert_details(string fname,string lname, int age, string location, string contactnumber, string email)
{
int id = get_id()+1;
int check=0;
string query = "INSERT INTO INVESTOR_INFO (INVESTOR_ID,FIRST_NAME,LAST_NAME,AGE,LOCATION,CONTACT_NUMBER,EMAIL,CHECKED) VALUES (@val1,@val2,@val3,@val4,@val5,@val6,@val7,@val8);";
try
{
conn.Open();
OleDbCommand command1 = new OleDbCommand(query,conn);
command1.Parameters.AddWithValue("@val1", id);
command1.Parameters.AddWithValue("@val2", fname);
command1.Parameters.AddWithValue("@val3", lname);
command1.Parameters.AddWithValue("@val4", age);
command1.Parameters.AddWithValue("@val5", location);
command1.Parameters.AddWithValue("@val6", contactnumber);
command1.Parameters.AddWithValue("@val7", email);
command1.Parameters.AddWithValue("@val8", check);
command1.CommandType = CommandType.Text;
command1.ExecuteNonQuery();
// conn.Close();
}
catch (Exception e)
{
throw new Exception(e.Message);
}
finally
{
conn.Close();
}
}//end of insert