SQL de SPT a ADO ?

19/08/2004 - 16:50 por MauricioPulla B. | Informe spam
Hola.
Con SPT podira ejecutar multiples SQL contra el servidor y me devolvia
varios cursores como puedo hacer para que con una Ado me haga el mismo
trabajo?

SPT: SqlExec(nCnn, "Select * from categories where categoryId = 1; Select *
from employees where EmployeeId = 1; Select * from Orders where employeeid 1")
ADO: ?

Con el siguiente ejemplo donde se crean los Cursores, como los recupero?

oCnn = CreateObject("adodb.connection")
oCnn.ConnectionString ="Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=Northwind;Data Source=ServerLocal"
oCnn.Open()
oCnn.CursorLocation = 3 && adUseClient
oCnn.Execute("Select * from categories where categoryId = 1; Select * from
employees where EmployeeId = 1; Select * from Orders where employeeid = 1")
oCnn.Close()

Windows 2000Pro, VFP 8.0 SP1
Maurcio Pulla.
Cuenca-Ecuador

Preguntas similare

Leer las respuestas

#1 dtto086
20/08/2004 - 16:41 | Informe spam
a ver si te srive:

mi_coneccion = createobject("adodb.connection")
mi_coneccion = "tu cadena connection string"
mi_coneccion.open

consulta1 = createobject("adodb.recordset")

consulta2 = createobject("adodb.recordset")

sentencia = createobject("adodb.command")

with sentencia
.CommandText = "Select * from tabla1"
.CommandType = 1
.ActiveConnection = mi_coneccion
endwith

consulta1.locktype = 3
consulta2.locktype = 3

consulta1 = sentencia.execute

sentencia.CommandText = "Select * from tabla2"

consulta2 = sentencia.execute



"MauricioPulla B." escribió en el mensaje
news:
Hola.
Con SPT podira ejecutar multiples SQL contra el servidor y me devolvia
varios cursores como puedo hacer para que con una Ado me haga el mismo
trabajo?

SPT: SqlExec(nCnn, "Select * from categories where categoryId = 1; Select


*
from employees where EmployeeId = 1; Select * from Orders where employeeid
1")
ADO: ?

Con el siguiente ejemplo donde se crean los Cursores, como los recupero?

oCnn = CreateObject("adodb.connection")
oCnn.ConnectionString ="Provider=SQLOLEDB.1;Integrated


Security=SSPI;Persist
Security Info=False;Initial Catalog=Northwind;Data Source=ServerLocal"
oCnn.Open()
oCnn.CursorLocation = 3 && adUseClient
oCnn.Execute("Select * from categories where categoryId = 1; Select * from
employees where EmployeeId = 1; Select * from Orders where employeeid 1")
oCnn.Close()

Windows 2000Pro, VFP 8.0 SP1
Maurcio Pulla.
Cuenca-Ecuador


Respuesta Responder a este mensaje
#2 MauricioPulla B.
21/08/2004 - 00:52 | Informe spam
Hola.
Gracias, por la ayuda
Mira aqui tengo otro codigo que hace igual

LOCAL oRs As "adodb.RecordSet", oCnn As "adodb.Connection", lcSql As String
oCnn = CREATEOBJECT("adodb.Connection")
oCnn.ConnectionString = "Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist Security Info=False;Initial Catalog=Northwind;Data
Source=LOCAL"
oCnn.Open()
lcSql = "Select LastName, FirstName From Employees where EmployeeId = 1;
Select * From orders where EmployeeId = 1; Select * from [Order Details]
Where OrderId In(Select OrderId From Orders Where employeeid = 1)"
oRs = oCnn.Execute(lcSql)
oRs.Save("Rs.Xml", 1)
XMLTOCURSOR("Rs.Xml", "RsCursor", 512)

oRs = oRs.NextRecordset
oRs.Save("Rs1.Xml", 1)
XMLTOCURSOR("Rs1.Xml", "RsCursor1", 512)

oRs = oRs.NextRecordset
oRs.Save("Rs2.Xml", 1)
XMLTOCURSOR("Rs2.Xml", "RsCursor2", 512)
El problema que tengo ahora es que al subir ultimo Rs2.Xml no mesube todos
los campos (smallint, real)

Nuevamente gracias por tu tiempo.

Saludos.
Mauricio Pulla.
Cuenca-Ecuador.


"dtto086" escribió en el mensaje
news:
a ver si te srive:

mi_coneccion = createobject("adodb.connection")
mi_coneccion = "tu cadena connection string"
mi_coneccion.open

consulta1 = createobject("adodb.recordset")

consulta2 = createobject("adodb.recordset")

sentencia = createobject("adodb.command")

with sentencia
.CommandText = "Select * from tabla1"
.CommandType = 1
.ActiveConnection = mi_coneccion
endwith

consulta1.locktype = 3
consulta2.locktype = 3

consulta1 = sentencia.execute

sentencia.CommandText = "Select * from tabla2"

consulta2 = sentencia.execute



"MauricioPulla B." escribió en el mensaje
news:
> Hola.
> Con SPT podira ejecutar multiples SQL contra el servidor y me devolvia
> varios cursores como puedo hacer para que con una Ado me haga el mismo
> trabajo?
>
> SPT: SqlExec(nCnn, "Select * from categories where categoryId = 1;


Select
*
> from employees where EmployeeId = 1; Select * from Orders where


employeeid
> > 1")
> ADO: ?
>
> Con el siguiente ejemplo donde se crean los Cursores, como los recupero?
>
> oCnn = CreateObject("adodb.connection")
> oCnn.ConnectionString ="Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist
> Security Info=False;Initial Catalog=Northwind;Data Source=ServerLocal"
> oCnn.Open()
> oCnn.CursorLocation = 3 && adUseClient
> oCnn.Execute("Select * from categories where categoryId = 1; Select *


from
> employees where EmployeeId = 1; Select * from Orders where employeeid > 1")
> oCnn.Close()
>
> Windows 2000Pro, VFP 8.0 SP1
> Maurcio Pulla.
> Cuenca-Ecuador
>
>


Respuesta Responder a este mensaje
#3 dtto086
23/08/2004 - 21:39 | Informe spam
Y si lo vuelves a mandar a un recordset? en vez de un cursor?

Yo jalo datos de un select, lo grabo como XLM y despues los vuelvo a
regresar a un Recordset.


"MauricioPulla B." escribió en el mensaje
news:
Hola.
Gracias, por la ayuda
Mira aqui tengo otro codigo que hace igual

LOCAL oRs As "adodb.RecordSet", oCnn As "adodb.Connection", lcSql As


String
oCnn = CREATEOBJECT("adodb.Connection")
oCnn.ConnectionString = "Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist Security Info=False;Initial Catalog=Northwind;Data
Source=LOCAL"
oCnn.Open()
lcSql = "Select LastName, FirstName From Employees where EmployeeId = 1;
Select * From orders where EmployeeId = 1; Select * from [Order Details]
Where OrderId In(Select OrderId From Orders Where employeeid = 1)"
oRs = oCnn.Execute(lcSql)
oRs.Save("Rs.Xml", 1)
XMLTOCURSOR("Rs.Xml", "RsCursor", 512)

oRs = oRs.NextRecordset
oRs.Save("Rs1.Xml", 1)
XMLTOCURSOR("Rs1.Xml", "RsCursor1", 512)

oRs = oRs.NextRecordset
oRs.Save("Rs2.Xml", 1)
XMLTOCURSOR("Rs2.Xml", "RsCursor2", 512)
El problema que tengo ahora es que al subir ultimo Rs2.Xml no mesube todos
los campos (smallint, real)

Nuevamente gracias por tu tiempo.

Saludos.
Mauricio Pulla.
Cuenca-Ecuador.


"dtto086" escribió en el mensaje
news:
> a ver si te srive:
>
> mi_coneccion = createobject("adodb.connection")
> mi_coneccion = "tu cadena connection string"
> mi_coneccion.open
>
> consulta1 = createobject("adodb.recordset")
>
> consulta2 = createobject("adodb.recordset")
>
> sentencia = createobject("adodb.command")
>
> with sentencia
> .CommandText = "Select * from tabla1"
> .CommandType = 1
> .ActiveConnection = mi_coneccion
> endwith
>
> consulta1.locktype = 3
> consulta2.locktype = 3
>
> consulta1 = sentencia.execute
>
> sentencia.CommandText = "Select * from tabla2"
>
> consulta2 = sentencia.execute
>
>
>
> "MauricioPulla B." escribió en el mensaje
> news:
> > Hola.
> > Con SPT podira ejecutar multiples SQL contra el servidor y me devolvia
> > varios cursores como puedo hacer para que con una Ado me haga el mismo
> > trabajo?
> >
> > SPT: SqlExec(nCnn, "Select * from categories where categoryId = 1;
Select
> *
> > from employees where EmployeeId = 1; Select * from Orders where
employeeid
> > > > 1")
> > ADO: ?
> >
> > Con el siguiente ejemplo donde se crean los Cursores, como los


recupero?
> >
> > oCnn = CreateObject("adodb.connection")
> > oCnn.ConnectionString ="Provider=SQLOLEDB.1;Integrated
> Security=SSPI;Persist
> > Security Info=False;Initial Catalog=Northwind;Data Source=ServerLocal"
> > oCnn.Open()
> > oCnn.CursorLocation = 3 && adUseClient
> > oCnn.Execute("Select * from categories where categoryId = 1; Select *
from
> > employees where EmployeeId = 1; Select * from Orders where employeeid
> 1")
> > oCnn.Close()
> >
> > Windows 2000Pro, VFP 8.0 SP1
> > Maurcio Pulla.
> > Cuenca-Ecuador
> >
> >
>
>


Respuesta Responder a este mensaje
#4 Mauricio Pulla B.
27/08/2004 - 16:15 | Informe spam
Hola dtto086.
Como haces ese paso de Xml a ADO.

Saludos.
Maurcio Pulla .
Cuenca-Ecuador.


"dtto086" escribió en el mensaje
news:
Y si lo vuelves a mandar a un recordset? en vez de un cursor?

Yo jalo datos de un select, lo grabo como XLM y despues los vuelvo a
regresar a un Recordset.


"MauricioPulla B." escribió en el mensaje
news:
> Hola.
> Gracias, por la ayuda
> Mira aqui tengo otro codigo que hace igual
>
> LOCAL oRs As "adodb.RecordSet", oCnn As "adodb.Connection", lcSql As
String
> oCnn = CREATEOBJECT("adodb.Connection")
> oCnn.ConnectionString = "Provider=SQLOLEDB.1;Integrated
> Security=SSPI;Persist Security Info=False;Initial Catalog=Northwind;Data
> Source=LOCAL"
> oCnn.Open()
> lcSql = "Select LastName, FirstName From Employees where EmployeeId 1;
> Select * From orders where EmployeeId = 1; Select * from [Order Details]
> Where OrderId In(Select OrderId From Orders Where employeeid = 1)"
> oRs = oCnn.Execute(lcSql)
> oRs.Save("Rs.Xml", 1)
> XMLTOCURSOR("Rs.Xml", "RsCursor", 512)
>
> oRs = oRs.NextRecordset
> oRs.Save("Rs1.Xml", 1)
> XMLTOCURSOR("Rs1.Xml", "RsCursor1", 512)
>
> oRs = oRs.NextRecordset
> oRs.Save("Rs2.Xml", 1)
> XMLTOCURSOR("Rs2.Xml", "RsCursor2", 512)
> El problema que tengo ahora es que al subir ultimo Rs2.Xml no mesube


todos
> los campos (smallint, real)
>
> Nuevamente gracias por tu tiempo.
>
> Saludos.
> Mauricio Pulla.
> Cuenca-Ecuador.
>
>
> "dtto086" escribió en el mensaje
> news:
> > a ver si te srive:
> >
> > mi_coneccion = createobject("adodb.connection")
> > mi_coneccion = "tu cadena connection string"
> > mi_coneccion.open
> >
> > consulta1 = createobject("adodb.recordset")
> >
> > consulta2 = createobject("adodb.recordset")
> >
> > sentencia = createobject("adodb.command")
> >
> > with sentencia
> > .CommandText = "Select * from tabla1"
> > .CommandType = 1
> > .ActiveConnection = mi_coneccion
> > endwith
> >
> > consulta1.locktype = 3
> > consulta2.locktype = 3
> >
> > consulta1 = sentencia.execute
> >
> > sentencia.CommandText = "Select * from tabla2"
> >
> > consulta2 = sentencia.execute
> >
> >
> >
> > "MauricioPulla B." escribió en el mensaje
> > news:
> > > Hola.
> > > Con SPT podira ejecutar multiples SQL contra el servidor y me


devolvia
> > > varios cursores como puedo hacer para que con una Ado me haga el


mismo
> > > trabajo?
> > >
> > > SPT: SqlExec(nCnn, "Select * from categories where categoryId = 1;
> Select
> > *
> > > from employees where EmployeeId = 1; Select * from Orders where
> employeeid
> > > > > > 1")
> > > ADO: ?
> > >
> > > Con el siguiente ejemplo donde se crean los Cursores, como los
recupero?
> > >
> > > oCnn = CreateObject("adodb.connection")
> > > oCnn.ConnectionString ="Provider=SQLOLEDB.1;Integrated
> > Security=SSPI;Persist
> > > Security Info=False;Initial Catalog=Northwind;Data


Source=ServerLocal"
> > > oCnn.Open()
> > > oCnn.CursorLocation = 3 && adUseClient
> > > oCnn.Execute("Select * from categories where categoryId = 1; Select


*
> from
> > > employees where EmployeeId = 1; Select * from Orders where


employeeid
> > > 1")
> > > oCnn.Close()
> > >
> > > Windows 2000Pro, VFP 8.0 SP1
> > > Maurcio Pulla.
> > > Cuenca-Ecuador
> > >
> > >
> >
> >
>
>


email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida