<% 'Esta página se encarga de las conecciones a la base de datos Function GetConnectionGeneric(dataBaseName, theServerDBName) 'Conecta a las bases de datos del programa If dataBaseName <> "" Then 'Err.Clear On Error Resume Next Set ConnGeneric = Server.CreateObject("ADODB.Connection") If ConnGeneric.State <> 1 Then ConnGeneric.Open ("Provider=SQLOLEDB.1;Password=drnk-91;Persist Security Info=True;User ID=idonet;Initial Catalog=" & dataBaseName & ";Data Source=" & theServerDBName) Set GetConnectionGeneric = ConnGeneric End if If Err.number <> 0 Then GetConnectionGeneric = Err.Description End If Else GetConnectionGeneric = "Parametros Incompletos GetConnectionGeneric" End If End Function Function GetConnectionAccess() 'Conecta a las bases de datos del programa On Error Resume Next Set ConnAccess = Server.CreateObject("ADODB.Connection") If ConnAccess.State <> 1 Then ConnAccess.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\Inetpub\wwwroot\" & AppDirName & "\database\century21.mdb;Persist Security Info=True") Set GetConnectionAccess = ConnAccess End if If Err.number <> 0 Then GetConnectionAccess = Err.Description End If End Function Function GetAccessConnectionGeneric(dataBaseName) 'Conecta a las bases de datos del programa If dataBaseName <> "" Then 'Err.Clear On Error Resume Next Set ConnGeneric = Server.CreateObject("ADODB.Connection") If ConnGeneric.State <> 1 Then ConnGeneric.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../database/") & "\" & dataBaseName & ".mdb;Persist Security Info=False") Set GetAccessConnectionGeneric = ConnGeneric End if If Err.number <> 0 Then GetAccessConnectionGeneric = Err.Description End If Else GetAccessConnectionGeneric = "Parámetros Incompletos GetAccessConnectionGeneric" End If End Function Function GetTrustedConnectionGeneric(dataBaseName, theServerDBName) 'Conecta a las bases de datos del programa If dataBaseName <> "" Then 'Err.Clear On Error Resume Next Set ConnGeneric = Server.CreateObject("ADODB.Connection") If ConnGeneric.State <> 1 Then ConnGeneric.Open ("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=" & dataBaseName & ";Data Source=" & theServerDBName) Set GetTrustedConnectionGeneric = ConnGeneric End if If Err.number <> 0 Then GetTrustedConnectionGeneric = Err.Description End If Else GetTrustedConnectionGeneric = "Parametros Incompletos GetTrustedConnectionGeneric" End If End Function Function InsertInTable(tableName, fieldsNames, fieldsValues, theConn) 'Inserta los valores en los campos especificados y con la condición específica. If tableName <> "" And fieldsNames <> "" And fieldsValues <> "" And theConn <> "" Then On Error Resume Next myQueryInsert = "INSERT INTO " & tableName & " (" & fieldsNames & ") VALUES (" & fieldsValues & ")" theConn.Execute(myQueryInsert) InsertInTable = Err.Description Else InsertInTable = "Parametros Incompletos InsertInTable " End If End Function Function UpdateInTable(tableName, fieldsNamesValues, theCond, theConn) 'Hace update en la tabla y campos especificados. If tableName <> "" And fieldsNamesValues <> "" And theCond <> "" And theConn <> "" Then On Error Resume Next If theCond <> "" Then theWhereString = " WHERE " & theCond End If myQueryUpdate = "UPDATE " & tableName & " SET " & fieldsNamesValues & theWhereString theConn.Execute(myQueryUpdate) If Err.Number <> 0 Then Test "Error: " & Err.Description & " | Ejecutando Query: " & myQueryUpdate, 0 UpdateInTable = Err.Description Else UpdateInTable = "Parametros Incompletos UpdateInTable " End If End Function Function DeleteInTable(tableName, theCond, theConn) 'Borra los registros especificados en dt_condition de una tabla espec. If tableName <> "" And theCond <> "" And theConn <> "" Then On Error Resume Next If theCond <> "*" Then theWhereString = " WHERE " & theCond End If myQueryUpdate = "DELETE FROM " & tableName & theWhereString theConn.Execute(myQueryUpdate) If Err.Description <> "" Then DeleteInTable = Err.Description Else DeleteInTable = "" End If Else DeleteInTable = "Parametros Incompletos DeleteInTable " End If End Function Function GetRecordValue(tableName, fieldsNames, theCond, theConn) 'Lee una tabla y retorna un registro. If tableName <> "" And fieldsNames <> "" And theCond <> "" And theConn <> "" Then On Error Resume Next If theCond <> "" Then theWhereString = " WHERE " & theCond End If StrSql_BD = "SELECT " & Trim(fieldsNames) & " FROM " & Trim(tableName) & theWhereString Set RS_BD = theConn.Execute(StrSql_BD) If Not RS_BD.Eof Then For Each Item In RS_BD.Fields theFieldValues = theFieldValues & Item.Value & " - " Next GetRecordValue = Left(theFieldValues, Len(theFieldValues) - 2) GetRecordValue = Trim(GetRecordValue) theFieldValues = "" Else GetRecordValue = "Registro no encontrado" End If RS_BD.Close Set RS_BD = Nothing If Err.number <> 0 Then GetRecordValue = Err.Description End If Else GetRecordValue = "Parametros Incompletos GetRecordValue " End If End Function %>