hola que tal ? estoy intentando insertar fotos en una base de datos y me sale el sig. error:
Server Error in '/login' Application.
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
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.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Source Error:
Line 88: com.Parameters.Add("@transaccion", SqlDbType.NVarChar, 50, "transaccion");
Line 89: adap.InsertCommand = com;
Line 90: adap.Update(tblim);
Line 91: }
Line 92: protected void Button1_Click(object sender, EventArgs e)
Source File: c:\Documents and Settings\PC\Mis documentos\Visual Studio 2005\WebSites\login\FileUpload.aspx.cs Line: 90
el codigo del proceso para insertar es :
protected void Insertar_Tabla(string nom, byte[] fo, string tipoInm, string zon, string transac)
{
SqlConnection micon = new SqlConnection();
SqlDataAdapter adap = new SqlDataAdapter();
micon.ConnectionString =
"Data Source=./SQLEXPRESS;AttachDbFilename=C:/Documents and Settings/PC/Mis documentos/Visual Studio 2005/WebSites/Borelli/App_Data/propiedades.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True;Context Connection=False";
DataSet1.imagenesDataTable tblim = new DataSet1.imagenesDataTable();
DataRow filaim = tblim.NewRow();
filaim.BeginEdit();
filaim["nombre"] = nom;
filaim["foto"] = fo;
filaim["tipoInmueble"] = tipoInm;
filaim["zona"] = zon;
filaim["transaccion"] = transac;
filaim.EndEdit();
tblim.Rows.Add(filaim);
SqlCommand com = new SqlCommand();
com.Connection = micon;
com.CommandText =
"INSERT INTO imagenes VALUES (@nombre, @foto, @tipoInmueble, @zona, @transaccion)";
com.Parameters.Add("@nombre", SqlDbType.NVarChar, 50, "nombre");
com.Parameters.Add("@foto", SqlDbType.Image, 500, "foto");
com.Parameters.Add("@tipoInmueble", SqlDbType.NVarChar, 50, "tipoInmueble");
com.Parameters.Add("@zona", SqlDbType.NVarChar, 50, "zona");
com.Parameters.Add("@transaccion", SqlDbType.NVarChar, 50, "transaccion");
adap.InsertCommand = com;
adap.Update(tblim);
}
gracias