Foros del Web » Programando para Internet » ASP Clásico »

Crear Tablas Sql Server 2000 Desde Web

Estas en el tema de Crear Tablas Sql Server 2000 Desde Web en el foro de ASP Clásico en Foros del Web. CREAR TABLAS SQL SERVER 2000 DESDE EL WEB ESTA UTILIDA ES MUY BUENA A LA HORA DE CREAR UNA O VARIAS TABLAS DE UNA BASE ...
  #1 (permalink)  
Antiguo 03/09/2002, 13:10
Avatar de DARIOI  
Fecha de Ingreso: mayo-2001
Ubicación: Gotland-Visvy
Mensajes: 181
Antigüedad: 24 años
Puntos: 0
Crear Tablas Sql Server 2000 Desde Web

CREAR TABLAS SQL SERVER 2000 DESDE EL WEB
ESTA UTILIDA ES MUY BUENA A LA HORA DE CREAR UNA O VARIAS TABLAS DE UNA BASE DE DATOS SQL DESDE INTERNET.
PAGE1.ASP:

<%
'variables
Dim strSQLServerName 'ip del servidor de base de datos
Dim strSQLDBUserName 'usuario que fue creado para accesar la base de datos
Dim strSQLDBPassword 'password que fue creado para accesar la base de datos
Dim strSQLDBName 'nombre de la base de datos creada a mano
'detalles del sql server 2000
strSQLServerName = "192.168.14.12" 'ip del servidor de base de datos
strSQLDBUserName = "sa" 'usuario que fue creado para accesar la base de datos
strSQLDBPassword = "" 'password que fue creado para accesar la base de datos
strSQLDBName = "quintanabaseppressdemo" 'nombre de la base de datos creada a mano
'nota:
'optimisado para SQL OLE DB Driver
'si usa sistemas DSN para conectar la SQL Server database la performance es menor
'SQL Server OLE Driver
strCon = "Provider=SQLOLEDB;Server=" & strSQLServerName & ";User ID=" & strSQLDBUserName & ";Password=" & strSQLDBPassword & ";Database=" & strSQLDBName & ";"
%>

  #2 (permalink)  
Antiguo 03/09/2002, 13:12
Avatar de DARIOI  
Fecha de Ingreso: mayo-2001
Ubicación: Gotland-Visvy
Mensajes: 181
Antigüedad: 24 años
Puntos: 0
Re: Crear Tablas Sql Server 2000 Desde Web

CONTINUACION
PAGE2.ASP
<% Option Explicit %>
<!--#include file="Page1.asp" -->
<%
Response.Buffer = False
%>
<html>
<head>
<title>crear tablas desde internet</title>
<script language="JavaScript">
<!-- Hide from older browsers...
//Function chekea formulario
function CheckForm () {
var errorMsg = "";
//para el Usuario
if (document.frmLogin.name.value==""){
errorMsg += "\n\tUsuario \t- Ingrese el Usuario por el cual le crearon el acceso a la base de datos";
}
//para la Password
//if (document.frmLogin.password.value==""){
//errorMsg += "\n\tPassword \t- Ingrese el Password por el cual le crearon el acceso a la base de datos";
//}
//despliege de errores
if (errorMsg != ""){
msg = "____________________________________________ _________________________\n\n";
msg += "tu Logeo al SQL Server ha fallado por causa del formulario.\n";
msg += "corrija los problema(s) y reenvie el formulario.\n";
msg += "____________________________________________ _________________________\n\n";
msg += "Los siguiente campo(s) necesitan ser corregidos: -\n";

errorMsg += alert(msg + errorMsg + "\n\n");
return false;
}

return true;
}
// -->
</script>

</head>
<body bgcolor="#FFFF00" text="#333333">
  #3 (permalink)  
Antiguo 03/09/2002, 13:13
Avatar de DARIOI  
Fecha de Ingreso: mayo-2001
Ubicación: Gotland-Visvy
Mensajes: 181
Antigüedad: 24 años
Puntos: 0
Re: Crear Tablas Sql Server 2000 Desde Web

CONTINUACION PAGE2.ASP
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="center">
<h1>Creando tablas no existentes en una base de datos sql server 2000</h1>
</td>
</tr>
</table>
<div align="center"><br>
<font face="Verdana, Arial, Helvetica" size="2">Para crear tablas no existentes en una base de datos SQL Server Database desde internet<br>
primero debes crear la base de datos vacia sobre el Server.<font face="Verdana, Arial, Helvetica" size="2"><br>
<br>
ingrese el usuario y la password que le entregaron para accesar la base de datos<br>
<br>
<b>disfruten esta herramienta gentileza de Cristian Quintana B. chile 2002</b></font></font><br>
</div>
<form name="frmLogin" method="post" action="Page2.asp" onSubmit="return CheckForm();">
<table width="100%" border="0" cellspacing="0" cellpadding="1" align="CENTER" bgcolor="#FFGGHH">
<tr>
<td>
<table width="70%" border="0" align="center" cellspacing="0" cellpadding="0" bgcolor="#CC00000">
<tr>
<td align="center">Usuario:<input type="text" name="name"></td>
</tr>

<tr>
<td align="center">Password:<input type="password" name="password"></td>
</tr>

<tr>
<td align="center"><input type="submit" name="Submit" value="Crear las tablas"><input type="reset" name="Submit" value="Limpiar"></td>
</tr>
</table>
</td>
</tr>
</table>
contrataciones desarollo Asp: [email protected]<br>
craciones: www.b2u.cl www.ecrchile.cl www.revistabarras.cl www.revistalyd www.care.cl www.singolpes.cl www.confiare.cl proximamente: www.medwebnet.cl
</form>
  #4 (permalink)  
Antiguo 03/09/2002, 13:14
Avatar de DARIOI  
Fecha de Ingreso: mayo-2001
Ubicación: Gotland-Visvy
Mensajes: 181
Antigüedad: 24 años
Puntos: 0
Re: Crear Tablas Sql Server 2000 Desde Web

CONTINUACION PAGE2.ASP
<table width="702" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
<%
Dim adoCon 'variable coneccion a base de datos
Dim strCon 'driver, path y nombre de la base de datos
Dim strSQL 'query de la base de datos
Dim intBadWordLoopCounter 'filtraje a db contador
Dim blnErrorOccured 'vuelva a true si un error ocurre
'resumen sobre todos los errores
On Error Resume Next
'inicializa variable
blnErrorOccured = False
'evalua que no este en blanco
If NOT Request.Form("name") = "" Then
Set adoCon = Server.CreateObject("ADODB.Connection")
strCon = "Provider=SQLOLEDB;Server=" & strSQLServerName & ";User ID=" & Request.Form("name") & ";Password=" & Request.Form("password") & ";Database=" & strSQLDBName & ";"
adoCon.Open strCon

'si un error ocurre lo escribe en la pagina
If Err.Number <> 0 Then
Response.Write("<br><b>Error al conectar la base de datos sobre SQL Server</b><br><br>corrija:- <br><br>SQL Server Usuario<br>SQL Server Password<br>")
Response.Write("Nombre del SQL Server<br>set el nombre de sql <br>set a vacia la base de datos <br><br>corrija la coneccion sobre 'Page1.asp' <br><br>")
Else
'CREANDO LAS TABLA PON TU TABLA QUI

'Create the Author Table
strSQL = "CREATE TABLE [dbo].[tblAuthor] ("
strSQL = strSQL & "[Author_ID] [int] IDENTITY (1, 1) PRIMARY KEY CLUSTERED NOT NULL ,"
strSQL = strSQL & "[Username] [nvarchar] (20) NOT NULL ,"

'Write to the database
adoCon.Execute(strSQL)

'If an error has occured write an error to the page
If Err.Number <> 0 Then
Response.Write("<br>error al crear la tabla por segunda vez(ya existe)<br>")

'Reset error object
Err.Number = 0

'Set the error boolean to True
blnErrorOccured = True
End If

'Display a message to say the database is curated
If blnErrorOccured = True
  #5 (permalink)  
Antiguo 03/09/2002, 13:15
Avatar de DARIOI  
Fecha de Ingreso: mayo-2001
Ubicación: Gotland-Visvy
Mensajes: 181
Antigüedad: 24 años
Puntos: 0
Re: Crear Tablas Sql Server 2000 Desde Web

CONTINUACION Y FINAL
PAGE2.ASP
Response.Write("<br><b>error SQL Server database!</b>")
Else
Response.Write("<br><center><f ont size=""4""><b>felicid ades ya fue creada su tabla(s) :)</b></font></center>")
End If
End If

'Reset Server Variables
Set adoCon = Nothing
Set strCon = Nothing
End If
%>
</font></td>
</tr>
</table>
<br>
</body>
</html>
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 07:58.