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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ObjectDataSource.SelectMethod = instance of class

Status
Not open for further replies.

boggg1

Programmer
Oct 17, 2002
102
0
0
EU
I have a ObjectDataSource (ods) linked to a GridView (gv) on a web page pulling data from Oracle storred procedures. The defined (corporate) solution involves statically setting properties in the ods and gv and the method is quick and reliable. But I have desktop VB6 code and some 50 SQL queries which do something similar and I am migrating this VB6 solution across to web based VB.NET to give it a future. I could create 50 static gv's and 50 static ods's and that would work but I would like to try to use one ods and one gv and reprogram it to cope with multiple numbers of inputs, multiple columns of returned data and multiple ways of displaying that data. So far my part corporate, part personal code does the following:

Press one of 50 search buttons on web page
Code behind loads odv and gv properties to match the particular button
(The code behind knows which Oracle query to call, knows the size of grid, can read the inputs (premises) from the web page etc)
In particular:
odv.TypeName = "Search"
(Search is a class defined in Search.vb under App_Code)
odv.SelectMethod = "GetHistory"
(GetHistory is a public function in class Search under App_Code)
Connect ods to gv thus "firing" the GetHistory procedure
GetHistory connects the ods to the Oracle package and ensures the data comes back in a suitable cursor for the gv to interpret

It works but I am working on the best way for the code behind (which contains all the inputs from the web page which will become inputs to the SQL) to talk to GetHistory (which sends them to Oracle).

I did it first by creating a public array in Search.vb, filling the array in the code behind and retrieving it in GetHistory - that also works
But this makes the array "behave" like a global (it can only have one value within the solution at one time) and I would like to use instances of Search, rather than Search itself, allowing multiple copies of the array

The question:
If I define an instance of Search (Dim Search1 = new Search or similar) can I pass Search1 to the ods, something like...
odv.TypeName = "Search1"
odv.SelectMethod = "GetHistory"

This code gives error:

The type specified in the TypeName property of ObjectDataSource 'ods' could not be found

...but then TypeName is way beyond my VB6 based understanding at this time. It also troubles me that you can apparently set set these as text values when almost everything else in VB.NET needs objects.

Warning - VB.NET newbie

Boggg1
[Bigglasses]
 

Since Search is a class, it is a Type that you can use to Dim an instance, like you do in your code:

Dim Search1 As New Search

Search1 is an instance of Search.
Search is a Type.

I don't know how to do what you are wanting, because I've never worked with Oracle.

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top