Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: StoredProcedure in DLL


Message #1 by bry@p... on Wed, 20 Nov 2002 16:14:23
Hi!
Ive made this function based on an ex from Beg.asp.net. Its changed to be 
using a stored procedure. It seems as if the SP: Query1 doesnt catch the 
value of the variable ISBN. This I guess, because I use an almost 
identical function to fill a dropdownlist, which later will supply the 
value for the ISBN variable. The function which doesnt work looks like 
this:
----------------
public function FuncQueryOne(ISBN as string) as DataSet

  dim objConnection as New OleDbConnection(m_DSN)
    objConnection.Open()

  dim objCmd as New OleDbCommand()
    objCmd.Connection=objConnection
    objCmd.CommandText="[Query1]"
    objCmd.CommandType = CommandType.StoredProcedure

  dim myDataAdapter as New OleDbDataAdapter(objCmd)
			
  dim DataSetTwo as New DataSet()
    myDataAdapter.Fill(DataSetTwo, "Authors")

    return DataSetTwo
    objConnection.Close()
end function
-------------------

My CodeBehind file contains this in the Page_Load sub:
-------------------
DataGrid1.DataSource=objPubClassNameDLL.FuncQueryOne_ 
(DropDownList1.SelectedItem.Value)
DataGrid1.DataBind()
-------------------

As mentioned, the main difference of this func and the other one which 
works, is the 'ISBN as String' variable.

Could anyone please show me whats wrong with my code?
Message #2 by bry@p... on Wed, 20 Nov 2002 16:28:50
Sorry I didnt mention the Error I get:

'Too few parameters. Expected 1'

referring to this line:

Line 23: 		
	DataGrid1.DataSource=objPubClassNameDLL.FuncQueryOne
(DropDownList1.SelectedItem.Value)

  Return to Index