Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Can I to convert a variable from Access to SQL Server? 2

Status
Not open for further replies.

omauri

Programmer
Jan 24, 2001
12
0
0
CO
Hi. I want this:

- Storing a value in a variable declared in Access (I work with file *.adp) Example: Dim Ident as integer

- Using THIS VALUE in a Stored Procedure as a input parameter. I don't know how to do it!!! Help me please!!!

Thanks

Mauricio
 
The code for setting up an integer as a parameter in a stored procedure would be

@Ident int

then from Access you call the stored procedure using the command object and create a parameter and assign your Access variable to it


here is some sample code (need to add variable declarations etc) with a string parameter


Andy


'set up command object



set objcommand = server.createobject("adodb.command")
objcommand.activeconnection = dbconnection
objcommand.CommandText = "et_REP_sp_generic_report_final_2"
objcommand.CommandType = adCmdStoredProc

'assign the parameters (must be in correct order for SQL stored procedure or the order they are encountered in in the Access where clause
'PARAMETER 1
set objparam = objcommand.createparameter("@country",advarchar, adparaminput, 50)
objcommand.parameters.append objparam
objcommand.parameters("@country") = strcountry

' Execute the sql
set rs=objcommand.execute

'release memory re command object
set objparam=nothing
set objcommand=nothing


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top