Foros del Web » Programación para mayores de 30 ;) » .NET »

problemas de conexion a sql server en c#

Estas en el tema de problemas de conexion a sql server en c# en el foro de .NET en Foros del Web. tengo problemas con la conexion a sql server no se a que se deva aqui pongo el codigo para que lo revisen y me puedan ...
  #1 (permalink)  
Antiguo 08/07/2005, 12:15
 
Fecha de Ingreso: abril-2005
Ubicación: GUANAJUATO,MEXICO
Mensajes: 216
Antigüedad: 19 años
Puntos: 0
problemas de conexion a sql server en c#

tengo problemas con la conexion a sql server no se a que se deva aqui pongo el codigo para que lo revisen y me puedan ayudar a corregirlo, o sino me pueden decir donde investigar para realizar una conexion adecuada a sql server, todo esto lo con mono.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Documento sin t&iacute;tulo</title>
<style type="text/css">
<!--
body {
background-color: #f8f8f4;
}
-->
</style></head>
<body>
<form runat="server">

<table width="733" height="92" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="23" colspan="2">&nbsp;</td>
<td height="23">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="23" colspan="2"><strong>Clave : </strong></td>
<td width="207" height="23"><asp:Label ID="numero" Font-Size="10" ForeColor="#FF0000" runat="server"></asp:Label></td>
<td width="335">&nbsp;</td>
</tr>
<tr>
<td height="23" colspan="2"><strong>Categorias :</strong></td>
<td height="23"><div align="right"><strong>N&ordm; de discos : </strong></div></td>
<td><asp:TextBox ID="cantidad" Width="40"runat="server" ></asp:TextBox></td>
</tr>
<tr>
<td width="188" height="24" rowspan="2">
<asp:checkboxlist ID="SELECATEGO" runat="server">
<asp:ListItem Text="Musica" runate="server"/>
<asp:ListItem Text="Sistemas operativos" runate="server"/>
<asp:ListItem Text="Trabajos escuela" runate="server"/>
<asp:ListItem Text="Respaldo" runate="server"/>
<asp:ListItem Text="Videos" runate="server"/>
<asp:ListItem Text="Juegos" runate="server"/>
<asp:ListItem Text="Programas" runate="server"/>
<asp:ListItem Text="Peliculas" runate="server"/>
</asp:checkboxlist>
</td>
<td width="3" rowspan="2"></td>
<td><div align="right"><strong>Descripci&oacute;n del disco :</strong></div></td>
<td rowspan="2"><asp:TextBox ID="descripcion" Height="100" Width="300" TextMode="multiline" runat="server" ></asp:TextBox>
<div align="left"></div>
<div align="left"></div></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td height="10" colspan="3"><asp:Label ID="FALLO" Font-Size="10" ForeColor="#FF0000" runat="server"></asp:Label> </td>
<td><asp:Button Text="Guardar" OnClick="GUARDARDISCO" runat="server"></asp:Button> </td>
</tr>
<tr>
<td colspan="4">&nbsp;</td>
</tr>
</table>
</form>
<SCRIPT language="c#" runat="server">

void GUARDARDISCO(Object sender, EventArgs e)
{
int c=0,b,a=0;
FALLO.Text="<strong>ADVERTENCIA :</strong><BR>";
string cate;
if(descripcion.Text=="")
{
FALLO.Text=FALLO.Text+" - Falta descripcion del disco <br>";
a=1;
}

if(cantidad.Text=="")
{
FALLO.Text=FALLO.Text+" - Falta N. de discos <br>";
a=1;
}else{
if(IsNumeric(cantidad.Text)==false)
{
FALLO.Text=FALLO.Text+" - Valor no numerico <br>";
a=1;
}
}

for(b=0;b<SELECATEGO.Items.Count; b++)
{
if(SELECATEGO.Items[b].Selected)c=1;
}
//FALLO.Text=FALLO.Text+SELECATEGO.SelectedItem.Text ;
if(c==0)
{
FALLO.Text=FALLO.Text+" - Falta asignar categoria(s) <br>";
a=1;

}

if(a==0)
{
System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection("Initial Catalog=disco;Data Source=SEEVYT-79F4JFOK;user id=sa;pwd=seevyt;Integrated Security=SSPI");
try
{
//conn.Open();
// Insert code to process data.
FALLO.Text="Conexiòn satisfactoria";
}
catch (Exception ex)
{
FALLO.Text=FALLO.Text+" - La conexiòn fallo.......<br>"+ex;
}
finally
{
//conn.Close();
}
}
}

/****************************/
public bool IsNumeric(string s)
{
try{
int a=Int32.Parse(s);
return true;
}
catch{
return false;
}

}



</SCRIPT>
</body>
</html>
  #2 (permalink)  
Antiguo 08/07/2005, 13:44
Avatar de xknown  
Fecha de Ingreso: diciembre-2004
Ubicación: Cusco - Perú
Mensajes: 2.248
Antigüedad: 19 años, 4 meses
Puntos: 7
Y el error es?
__________________
Alex Concha
Buayacorp - Programación y Diseño
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:35.