|
-
Mar 6th, 2006, 10:46 AM
#1
[RESOLVED] ADO parameters.. in query
How do I pass in Params to a regular Recordset query??
the query that the data is pulling from is like this:
PARAMETERS c_CILLI Text ( 255 );
SELECT Fields.... etc
there are about 10 more queries after this that finally feed a union query that I am pulling off of....
So.. my query is
"SELECT * INTO tbl_temp_data FROM quniTABLE"
now.. it wants the param...? how do I pass it in?
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Mar 6th, 2006, 11:40 AM
#2
Re: ADO parameters.. in query
Create a Command Object and pass the parameters that way.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 6th, 2006, 11:45 AM
#3
Re: ADO parameters.. in query
ok.. maybe I did it worng.. but It didnt work!??
lemme try again
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Mar 6th, 2006, 11:48 AM
#4
Re: ADO parameters.. in query
doesnt like it?? did I do this wrong?
VB Code:
Dim rst As New Recordset
Dim cmd As New ADODB.Command
Dim param As New ADODB.Parameter
Dim tmp() As String
Dim SQL As String
tmp = Split(cboCILLI, " - ")
SQL = "SELECT COLLO, CILLI, COLLO_NAME, ADDRESS, SWITCH, ILEC_ZONE, " & _
"TRO_DS1_LOOP , TRO_TIER1, NET_ONOFF, T1, TRUNK_MUX, MILES " & _
"Into tbl_temp_COLLO_DATA " & _
"FROM quniCOLLO_DATA"
param.Name = "c_CILLI"
param.Value = tmp(0)
param.Type = adVarChar
CNN.Execute "DROP TABLE tbl_temp_COLLO_DATA"
cmd.ActiveConnection = CNN
cmd.CommandText = SQL
cmd.CommandType = adCmdText
cmd.Parameters.Append param
Set rst = cmd.Execute
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Mar 6th, 2006, 11:48 AM
#5
Re: ADO parameters.. in query
This is an Access db or a SQL server db?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 6th, 2006, 11:49 AM
#6
Re: ADO parameters.. in query
sorry
Error:
3708
Parameter object is improperly defined. Inconsistant or Incomplete information was provided
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Mar 6th, 2006, 11:49 AM
#7
Re: ADO parameters.. in query
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Mar 6th, 2006, 11:50 AM
#8
Re: ADO parameters.. in query
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 6th, 2006, 11:52 AM
#9
Re: ADO parameters.. in query
Probably needing to specify the storedproc property.
VB Code:
Set goRs = New ADODB.Recordset
Set oCM = New ADODB.Command
With oCM
.ActiveConnection = goEnv.Cnn
.CommandType = adCmdStoredProc
.CommandText = sSP_Name
.Prepared = True
.Parameters.Append .CreateParameter("@Where", adChar, adParamInput, 10, Mid$(sWhere, 2))
End With
goRs.CursorLocation = adUseClient
goRs.Open oCM, , adOpenKeyset, adLockOptimistic, adCmdStoredProc
Set Exec_SPrRS = goRs
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 6th, 2006, 12:45 PM
#10
Re: ADO parameters.. in query
To execute the Parameter Query use
VB Code:
With cmd
.CommandText = "[quniCOLLO_DATA]"
[B] .CommandType = adCmdTable[/B] 'adCmdUnknown when specifying a Select List
.Parameters.Append .CreateParameter("@Parm1", adVarChar, adParamInput,255 , Mid$(sWhere, 2))
Set .ActiveConnection = db
Set rs = .Execute
End With
To use the Parameter Query as a dataset to another query use
VB Code:
With cmd
.CommandText = "Select * Into tblTempDate From [quniCOLLO_DATA]"
[B] .CommandType = adCmdUnknown[/B]
.Parameters.Append .CreateParameter("@Parm1", adVarChar, adParamInput,255 , Mid$(sWhere, 2))
Set .ActiveConnection = db
.Execute , , adExecuteNoRecords
End With
Parameter object is improperly defined. Inconsistant or Incomplete information was provided
You must specify the Size property of the Parameter object when its data type is variable length.
Last edited by brucevde; Mar 6th, 2006 at 01:06 PM.
-
Mar 6th, 2006, 12:51 PM
#11
Re: ADO parameters.. in query
Oops for got to change that as I pulled the code from a project of mine.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 6th, 2006, 01:08 PM
#12
Re: ADO parameters.. in query
ok.. I couldnt get it to work with a select list.. but when I used the mak table query name it work perfectly! thanks!
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|