General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Como especificar o nome de um parâmetro na consulta ?
Pessoal,
Como posso especificar o nome do parâmetro nesta linha?
"Select * from Customers where CustomerID = ?pTeste"
-------------
Veja o código de exemplo abaixo:
lcConString = "Provider=SQLOLEDB.1; Persist Security Info=False; User ID=sa; Password=password; Initial Catalog=NorthWind; Data Source=Baferge"
loCon = CreateObject("ADODB.Connection")
loCon.Open(lcConString)
************************************************************************
loCmd = CreateObject("ADODB.Command")
loParam = loCmd.CreateParameter("pTeste", 129, 3, 15, "ALFKI")
loCmd.Parameters.Append(loParam)
loCmd.ActiveConnection = loCon
loCmd.CommandText = "Select * from Customers where CustomerID = ?pTeste" && Como informar o nome do parâmetro aqui ?
************************************************************************
* loRS = loCon.Execute("Select * from Customers", )
loRS = loCmd.Execute()
************************************************************************
DO WHILE !loRS.EOF
?loRS.Fields("CustomerID").Value
loRS.MoveNext
EndDo
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only