Ver Mensaje Individual
  #7 (permalink)  
Antiguo 21/05/2007, 04:00
mari90
 
Fecha de Ingreso: agosto-2006
Mensajes: 38
Antigüedad: 17 años, 10 meses
Puntos: 0
Re: error al subir aplicación web en servidor web

Os dejo 2 de los errores que me da y las consultas relacionadas con esos errores:

Could not delete from specified tables.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Could not delete from specified tables.

Source Error:


Line 1085: //al parametro validohasta le asigno el valor de la fecha de hoy
Line 1086: comandoeliminar.Parameters.Add(new OleDbParameter("validohasta", fechahoy));
Line 1087: int res = comandoeliminar.ExecuteNonQuery();
Line 1088: cerrarconexion();
Line 1089:


Source File: c:\Inetpub\wwwroot\TUTORIAS\App_Code\gestorbd.cs Line: 1087

consulta en la que me da el error, me da el error justo en el ExecuteNonQuery:

public void borraravisosnovalidos(string usuarioprofe, DateTime fechahoy)
{
abrirconexion();
string consulta1 = "DELETE FROM avisos AS A WHERE A.profesor=? and A.validohasta < ?";
string consulta = consulta1;
OleDbCommand comandoeliminar = new OleDbCommand(consulta, conn);

comandoeliminar.Parameters.Add(new OleDbParameter("profesor", usuarioprofe));
comandoeliminar.Parameters.Add(new OleDbParameter("validohasta", fechahoy));
int res = comandoeliminar.ExecuteNonQuery();
cerrarconexion();

}


ERROR2:

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 611: string consulta = "SELECT depto FROM profesor AS P WHERE P.usuario='" + usuarioprofe + "'";
Line 612: OleDbCommand comandosel = new OleDbCommand(consulta, conn);
Line 613: int codigo = (int)comandosel.ExecuteScalar();//ejecuta la consulta y devuelve la primera columna de la primera fila del cjto de resultados devuelto por la consulta
Line 614: cerrarconexion();
Line 615: return codigo;


Source File: c:\Inetpub\wwwroot\TUTORIAS\App_Code\gestorbd.cs Line: 613

CONSULTA en la que me da el error, justo en la instruccion ExecuteScalar


//obtener el codigo del depto al que pertenece el profe
public int codigodepto(string usuarioprofe)
{
abrirconexion();
string consulta = "SELECT depto FROM profesor AS P WHERE P.usuario='" + usuarioprofe + "'";
OleDbCommand comandosel = new OleDbCommand(consulta, conn);
int codigo = (int)comandosel.ExecuteScalar();
cerrarconexion();
return codigo;
}

A ver si con esto te dice algo...porque yo por más que le doy vueltas no sé qué hacer.

Saludos,

Mari