Execute.Reader() problems

drgonzo7

New Member
I am having an issue with the execute.Reader method. It keeps giving me an error. The error message is: <BR>'ExecuteReader' is not a member of 'System.Data.SqlClient.SqlDataAdapter'.<BR><BR>Here is my code:<BR><BR><%@ Page Language="VB" %><BR><%@ Import Namespace="System.Data" %><BR><%@ Import Namespace="System.Data.SqlClient" %><BR><BR><html><BR><BR><head><title>Dispatch Information</title></head><BR><BR><body bgColor="whitesmoke" bottomMargin="0" leftMargin="0" topMargin="0" MS_POSITIONING="GridLayout"><BR><BR><form id="Form1" runat="server" /><BR><BR><%@ Register TagPrefix="uc1" TagName="MenuUserControl" Src=http://aspmessageboard.com/archive/index.php/"MenuUserControl.ascx" %><BR><BR><uc1:MenuUserControl id="SolpartMenu1" runat="server"></uc1:MenuUserControl><BR><BR><script language="VB" runat="server"><BR><BR>Sub Page_Load(sender As Object, e As EventArgs)<BR><BR> Dim MyConnection As SqlConnection<BR> Dim MyCommand As SqlDataAdapter<BR> <BR> MyConnection = 'the connection<BR> MyCommand = New SqlDataAdapter("dispatchinfo", MyConnection)<BR> <BR> MyCommand.SelectCommand.CommandType = CommandType.StoredProcedure<BR> <BR> Dim DR As SqlDataReader<BR> <BR> DR = MyCommand.ExecuteReader(CommandBehavior.CloseConne ction)<BR> DispatchResults.DataSource = DR<BR> DispatchResults.DataBind() <BR> DR.Close()<BR> <BR>End Sub <BR><BR><BR>Any clue to why it will not execute,<BR><BR>MattChange it from a SqlDataAdapter to a sqlcommand.
 
Back
Top