conexión sql server

txiki
09 de Enero del 2002
Saludos cordiales,
me gustaría conectar a una base de datos que esta en un dominio de una red local desde fuera, a esta red se entra por una ip que esta en un ordenador distinto al que esta la base de datos, como se podría hacer eso.Gracias

garbi
09 de Enero del 2002
intentalo con conexion por odbc

Nelson
09 de Enero del 2002
Te envio una pagina que se conecta a SQL Ejecuta un procedimiento almacenado con parametros

<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<script language="VB" runat="server">
Dim MyConnection As SqlConnection

Sub Page_Load(sender As Object, e As EventArgs)
' MyConnection = New SqlConnection("data source=DESARROLLO;initial catalog=PORTALCEU;persist security info=False;user id=NGSA;packet size=4096")
MyConnection = New SqlConnection("server=desarrollo;uid=ngsa;pwd=ngsa;database=portalceu")
End Sub

Sub EnterBtn_Click(Sender As Object, E As EventArgs)

Dim MyCmd As SqlCommand
Dim MyPrm As SqlParameter

MyCmd = New SqlCommand("sp_UpdateContenido",MyConnection)
MyCmd.CommandType = CommandType.StoredProcedure

MyPrm = New SqlParameter("@pFd_IdContenido",SqlDbType.Int)
MyPrm.DIrection = ParameterDirection.Input
MyPrm.value = 1
MyCmd.Parameters.Add (MyPrm)

MyPrm = New SqlParameter("@pFd_Noticias",SqlDbType.NVarChar,1)
MyPrm.DIrection = ParameterDirection.Input
iF CheckBox1.Checked Then
MyPrm.value = "1"
Else
MyPrm.value = "0"
End IF
MyCmd.Parameters.Add (MyPrm)

MyPrm = New SqlParameter("@pFd_Foros",SqlDbType.NVarChar,1)
MyPrm.DIrection = ParameterDirection.Input
iF CheckBox2.Checked Then
MyPrm.value = "1"
Else
MyPrm.value = "0"
End IF
MyCmd.Parameters.Add (MyPrm)


MyPrm = New SqlParameter("@pFd_Publicaciones",SqlDbType.NVarChar,1)
MyPrm.DIrection = ParameterDirection.Input
iF CheckBox3.Checked Then
MyPrm.value = "1"
Else
MyPrm.value = "0"
End IF
MyCmd.Parameters.Add (MyPrm)

MyPrm = New SqlParameter("@pFd_Eventos",SqlDbType.NVarChar,1)
MyPrm.DIrection = ParameterDirection.Input
iF CheckBox4.Checked Then
MyPrm.value = "1"
Else
MyPrm.value = "0"
End IF
MyCmd.Parameters.Add (MyPrm)

MyPrm = New SqlParameter("@pFd_Chat",SqlDbType.NVarChar,1)
MyPrm.DIrection = ParameterDirection.Input
iF CheckBox5.Checked Then
MyPrm.value = "1"
Else
MyPrm.value = "0"
End IF
MyCmd.Parameters.Add (MyPrm)

MyPrm = New SqlParameter("@pFd_Consulta",SqlDbType.NVarChar,1)
MyPrm.DIrection = ParameterDirection.Input
iF CheckBox6.Checked Then
MyPrm.value = "1"
Else
MyPrm.value = "0"
End IF
MyCmd.Parameters.Add (MyPrm)

MyPrm = New SqlParameter("@pFd_Biblioteca",SqlDbType.NVarChar,1)
MyPrm.DIrection = ParameterDirection.Input
iF CheckBox7.Checked Then
MyPrm.value = "1"
Else
MyPrm.value = "0"
End IF
MyCmd.Parameters.Add (MyPrm)

MyPrm = New SqlParameter("@pFd_Bolsa",SqlDbType.NVarChar,1)
MyPrm.DIrection = ParameterDirection.Input
iF CheckBox8.Checked Then
MyPrm.value = "1"
Else
MyPrm.value = "0"
End IF
MyCmd.Parameters.Add (MyPrm)

MyPrm = New SqlParameter("@pFd_Link",SqlDbType.NVarChar,1)
MyPrm.DIrection = ParameterDirection.Input
iF CheckBox9.Checked Then
MyPrm.value = "1"
Else
MyPrm.value = "0"
End IF
MyCmd.Parameters.Add (MyPrm)

MyConnection.Open()
MyCmd.executeNonQuery()
MyConnection.Close()
End Sub


</script>

<HTML>
<HEAD>
<title>Contenido</title>
<LINK rel=stylesheet href="CEU.css">
</HEAD>
<script language=JavaScript>
function openWindow(html){
window.open(html,'Titulo','height=230,width=660,status=no,toolbar=no,menubar=no');
}

function EventoMouseOver(x) // Al entrar
{
if(x==null)
x=window;
window.event.srcElement.style.background= '#0099FF';
window.event.srcElement.style.color = 'white';

}

function EventoMouseOut(x) // Al salir
{
if(x==null)
x=window;
window.event.srcElement.style.background= '#ffffff';
window.event.srcElement.style.color = '#000000';
}


function EventoClick(destino)
{
var url;
url = '/Inicio/' + destino;
FrmMenu.target = 'MarcoCOntenido';
FrmMenu.action = url;
FrmMenu.submit();}

function PantallaCompleta(destino){
var url;
url = '/inicio/' + destino;
window.parent.navigate(url);
}
-->
</script>
<body>
<form id="Form1" method="post" runat="server">
<TABLE align=right BORDER=0 cellPadding=0 cellSpacing=2>
<tr>
<tr>
<td ><IMG alt="Nuevo" border=0 src="imagenes/home.gif" class=menuitem onmouseover="EventoMouseOver()" onmouseout="EventoMouseOut()" onclick=" PantallaCompleta('default.htm');" ></td>
<td ><IMG alt="Ayuda" border=0 src="imagenes/help.gif" class=menuitem onmouseover="EventoMouseOver()" onmouseout="EventoMouseOut()" onclick="javascript:openWindow('beneficio.htm');"></td>
</tr>
</tr>
</table>
<h4>Personalize el contenido de su pagina</h4>

<table border="0" width="100%">
<tr>
<td align=right bgcolor=#cdcdcd>
<asp:Button id="Aplica1" text="Aplicar cambios" runat="server" />
</td>
</tr>
</table>
<br>

<table border="0" align="center" width="100%" >
<tr>

<td width="20%" vAlign="top"><IMG alt="" src="imagenes/contenido.gif"></td>
<td>
<table border="0" align="center" width="100%">
<tr>
<td><asp:CheckBox id="CheckBox1" runat="server" Text="CEU Noticias"></asp:CheckBox></td>
</tr>
<tr>
<td style="text-indent: 20; margin-top: 0"><p>Comentarios</p></td>
</tr>
</table>
<br>
<table border="0" align="center" width="100%">
<tr>
<td><asp:CheckBox id="CheckBox2" runat="server" Text="Foros Estudiantiles"></asp:CheckBox></td>
</tr>
<tr>
<td style="text-indent: 20; margin-top: 0"><p>Comentarios</p></td>
</tr>
</table>
<br>
<table border="0" align="center" width="100%">
<tr>
<td><asp:CheckBox id="CheckBox3" runat="server" Text="Publicaciones"></asp:CheckBox></td>
</tr>
<tr>
<td style="text-indent: 20; margin-top: 0"><p>Comentarios</p></td>
</tr>
</table>
<br>
<table border="0" align="center" width="100%">
<tr>
<td><asp:CheckBox id="CheckBox4" runat="server" Text="Calendario de Eventos"></asp:CheckBox></td>
</tr>
<tr>
<td style="text-indent: 20; margin-top: 0"><p>Comentarios</p></td>
</tr>
</table>
<br>
<table border="0" align="center" width="100%">
<tr>
<td><asp:CheckBox id="CheckBox5" runat="server" Text="Chat"></asp:CheckBox></td>
</tr>
<tr>
<td style="text-indent: 20; margin-top: 0"><p>Comentarios</p></td>
</tr>
</table>
<br>
<table border="0" align="center" width="100%">
<tr>
<td><asp:CheckBox id="CheckBox6" runat="server" Text="Consulta"></asp:CheckBox></td>
</tr>
<tr>
<td style="text-indent: 20; margin-top: 0"><p>Comentarios</p></td>
</tr>
</table>
<br>
<table border="0" align="center" width="100%">
<tr>
<td><asp:CheckBox id="CheckBox7" runat="server" Text="Biblioteca Virtual"></asp:CheckBox></td>
</tr>
<tr>
<td><p>Comentarios</p></td>
</tr>
</table>
<br>
<table border="0" align="center" width="100%">
<tr>
<td><asp:CheckBox id="CheckBox8" runat="server" Text="Bolsa de Trabajo"></asp:CheckBox></td>
</tr>
<tr>
<td style="text-indent: 20; margin-top: 0"><p>Comentarios</p></td>
</tr>
</table>
<br>
<table border="0" align="center" width="100%">
<tr>
<td><asp:CheckBox id="CheckBox9" runat="server" Text="Link"></asp:CheckBox></td>
</tr>
<tr>
<td style="text-indent: 20; margin-top: 0"><p>Permite mantener en su paginas los link de su interes</p></td>
</tr>
</table>

</td>
</tr>
<tr>
<td><asp:label id="Message" runat=server/></td>
</tr>

</table>

<br>

<table border="0" width="100%">
<tr>
<td align=right bgcolor=#cdcdcd>
<asp:Button id="Aplica2" text="Aplicar cambios" runat="server" Onclick="EnterBtn_Click" />
</td>
</tr>
</table>

</form>
</body>
</HTML>

txiki
09 de Enero del 2002
pero es para realizarla desde internet