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

Object reference not set to an instance of an object

Status
Not open for further replies.

mguwc

Technical User
Mar 16, 2004
74
US
Hi All - I have been working with this error message all day and I cannot figure out the problem. Can someone please help???? The code is as follows:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here

strDonationID = Request("cid")

If Not Me.Page.IsPostBack Then
Call LoadSelectedDonation()
End If

End Sub


Private Sub LoadSelectedDonation()
Dim rdr As SqlDataReader
Dim inParams As New UWSqlParameters

Try
inParams.CreateStringParameter("Switch", "@Switch", ParameterDirection.Input, 30)
inParams.SetString("Switch", "LoadSelectDon")
inParams.CreateStringParameter("strSearch", "@strSearch", ParameterDirection.Input, 1000)
inParams.SetString("strSearch", " AND DonDetailID = " & strDonationID)
rdr = Top.SPDatabase.ExecuteReader("uwc_DonationManagement_LoadDonSearch", inParams.AsCollection())

Do While rdr.Read
Me.txtDonDetailID.Text = rdr("DonDetailID")
Me.txtfldCount.Text = rdr("fldCount")
Me.txtSubtype.Text = rdr("SubType")
Me.txtPackaging.Text = rdr("Packaging")
Me.txtDonationDate.Text = rdr("DonationDate")
Me.txtDonor.Text = rdr("Name")
Me.txtDayPhone.Text = rdr("DayPhone")
Me.txtEvePhone.Text = rdr("EvePhone")
Me.txtCellPhone.Text = rdr("CellPhone")
Me.txtFaxPhone.Text = rdr("FaxPhone")
Me.txtNotes.Text = rdr("B.Notes")

Loop

Catch ex As System.Exception
UWFormUtilities.ErrorViewer = ex.ToString
Response.Redirect("frmErrorViewer.aspx")

Response.Write("Failed")
Response.Write(ex.ToString())
Finally
rdr.Close()
End Try
End Sub

My stored procedure is as follows:


Else if @Switch='LoadSelectDon'
Begin
SET @StrExec = ('SELECT DonDetailID,fldCount,SubType,Packaging,DonationDate,
[Organization]+''-'' + [FirstName] + '' ''+ [LastName] as Name, DayPhone, EvePhone, CellPhone, FaxPhone, B.Notes
FROM dbo.tbldonationsdetail as A, dbo.tbldonations as B,dbo.tblDonors as C
WHERE A.DonationID= B.DonationID
AND B.DonorID=C.DonorID
' + @strSearch)
EXEC(@strExec)
End

- Maria
 
rdr = Top.SPDatabase.ExecuteReader("uwc_DonationManagement_LoadDonSearch", inParams.AsCollection())

QuickWatch shows:

Overload resolution failed because no accessible 'ExecuteReader' accepts this number of arguments.

- Maria
 
It looks like you're giving your data access component the wrong number of arguments for it's ExecuteReader method. Couple of possibilities: Does your DAB contain a bunch of static methods or do you have to instantiate it before calling a method? Have you included it in your Import directive?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top