• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1487
  • Last Modified:

Using Parameters with the DataReader odbc SqlCommand

In my DataReader object of my SSIS package, I need to be able to pass in a date and time to the query. The correct date and time values are stored in a variable that I populate in a prior "Execute SQL Task" component in my Control Flow. I need to access the value in those variables to execute my dataReader.

How do you do this?
0
_Wade_
Asked:
_Wade_
  • 4
  • 3
  • 2
  • +1
1 Solution
 
jbyers79Commented:
if you want to use parameters, don't use the DataReader component.  Can you use the OLEDB data source component?
0
 
rob_farleyCommented:
It's definitely easier to do this using an OLEDB Source, and I find that I only ever use DataReader if I have a client who insists on using ADO.Net in between. The DataReader component is just far too restricted in its use.

Rob
0
 
PedroCGDCommented:
You can use parameters using OLEDB Source or Data Reader Source.
OLEDB Source is more easy... with Data Reader you need to use expression are is not soo complicated.
Do you want more details?

Helped?
Regards,
Pedro
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
_Wade_Author Commented:
Hi everyone. thanks for your responses. the reason why I'm using a DataReader is because I'm having to use ODBC. I'm accessing an AS400 datasource.

I'm assuming there's no other component besides DataReader for this.

I figured out how to use expressions yesterday for the datareader. SSIS is just so wonderful! I discovered that in order to do this "workaround" I needed to "fake" the Visual Studio designer out by giving the data reader a bogus sql command for it to populate it's metadata with column information. I post I found assured me that it it would work at runtime....

But, when i run my SSIS package it won't begin. It tells me there's a problem with the Datareader SQL command before it even gets to that point in the execution (it won't even execute the first step in the control flow).  It's pretty nonspecific. If it wouldn't let me cut and past the error (which was displayed in a dialog box instead of somewhere that I could access the actual text) I would show everyone the exact message. It had a few lines which made no sense, or at least told me nothing meaningful about what was wrong with my sql statement. It can't be a problem with parsing, since it didn't get far enough to parse against the actual datasource.

SSIS is giving me such a headache my boss told me to redesign my process with a VB.net console job. I'm doing that right now. It might prove easier. I've got less than a year in development experience so it's hard for me to tell these things in advance. :)

0
 
PedroCGDCommented:
do you want an example?
0
 
_Wade_Author Commented:
Sure!
0
 
rob_farleyCommented:
You should be able to use an OLEDB source, using an OLEDB for ODBC provider.

... and it's a lot more forgiving.

Rob
0
 
PedroCGDCommented:
0
 
_Wade_Author Commented:
That was a great example. Thanks Pedro!
0
 
PedroCGDCommented:
It's a pleasure!!
Regards,
Pedro
www.pedrocgd.blogspot.com
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now