0
I’m trying to make an Insert on a table and it’s always giving me error 00936 that says Missing Expression when you arrive at the command line cmd.executenonquery. Can anyone help me? Code I have:
using (OracleConnection conn = new OracleConnection(ConfigurationManager
.ConnectionStrings["CegosReportsOra"].ConnectionString))
{
conn.Open();
using (OracleCommand cmd = new OracleCommand())
{
String lang = System.Threading.Thread.CurrentThread.CurrentUICulture.ToString();
lang = "";
cmd.CommandType = CommandType.Text;
cmd.Connection = conn;
cmd.CommandText = "INSERT INTO ECICalendarEvent_Test(title, description, event_start, event_end, all_day) Values(@title, @description, @event_start, @event_end, @all_day)";
cmd.Parameters.Add("@title", OracleDbType.Varchar2).Value = cevent.title;
cmd.Parameters.Add("@description", OracleDbType.Varchar2).Value = cevent.description;
cmd.Parameters.Add("@event_start", OracleDbType.Date).Value = cevent.start;
cmd.Parameters.Add("@event_end", OracleDbType.Date).Value = cevent.end;
cmd.Parameters.Add("@all_day", OracleDbType.Char).Value = cevent.allDay;
cmd.ExecuteNonQuery();
int key = 0;
using (conn)
{
//get primary key of inserted row
cmd.CommandText = "SELECT max(event_id) FROM ECICalendarEvent_Test where title=@title AND description=@description AND event_start=@event_start AND event_end=@event_end AND all_day=@all_day";
cmd.Parameters.Add("@title", OracleDbType.Varchar2).Value = cevent.title;
cmd.Parameters.Add("@description", OracleDbType.Varchar2).Value = cevent.description;
cmd.Parameters.Add("@event_start", OracleDbType.Date).Value = cevent.start;
cmd.Parameters.Add("@event_end", OracleDbType.Date).Value = cevent.end;
cmd.Parameters.Add("@all_day", OracleDbType.Char).Value = cevent.allDay;
key = (int)cmd.ExecuteScalar();
}
return key;
}
The problem lies in the execution of the line of executenonquery. Can anyone tell me what I’m forgetting? Thank you. I have a table with 6 columns where one of them is the primary key (ID). Help me...
You have already tried to add Insert 'entreosParametros'?
– Marconi