Click here to Skip to main content
15,924,507 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: [Urgent] Sending Email from ASP.NET Pin
Kanjinghat12-May-06 1:18
Kanjinghat12-May-06 1:18 
QuestionAdding a file in APP_CODE folder on runtime. Pin
deepaks311-May-06 10:10
deepaks311-May-06 10:10 
AnswerRe: Adding a file in APP_CODE folder on runtime. Pin
Colin Angus Mackay11-May-06 10:33
Colin Angus Mackay11-May-06 10:33 
AnswerRe: Adding a file in APP_CODE folder on runtime. Pin
datacop11-May-06 10:35
datacop11-May-06 10:35 
QuestionSession State Timeout Pin
Jamie Nordmeyer11-May-06 8:57
Jamie Nordmeyer11-May-06 8:57 
AnswerRe: Session State Timeout Pin
Bhasker Pinninti11-May-06 10:23
Bhasker Pinninti11-May-06 10:23 
AnswerRe: Session State Timeout Pin
DotNetDominator11-May-06 17:53
DotNetDominator11-May-06 17:53 
QuestionError binding dataset Pin
playout11-May-06 8:05
playout11-May-06 8:05 
Hi all,
I would really appreciate your help on the following... I am very new to ASP 1.1, been using 2.0, but have to do some edits to asp 1.1 files.

I get the following error when binding my dataset to a datagrid:

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Line 23: dgMembers.DataSource = dsMembers

Here is my code:

ASPX:
		<br />
<br />
		<asp:datagrid id="dgMembers" runat="server" BorderWidth="0px" GridLines="None" BorderStyle="None"<br />
			CellPadding="0" Width="100%" AllowPaging="True" PageSize="15" PagerStyle-Visible="False" AutoGenerateColumns="False"><br />
			<Columns><br />
				<asp:TemplateColumn HeaderText="Name"><br />
					<HeaderStyle Width="70%" CssClass="Grid_HeaderStyle"></HeaderStyle><br />
					<ItemStyle CssClass="Grid_ItemStyle"></ItemStyle><br />
					<ItemTemplate><br />
						<asp:Label id="lblFirstName" Text='<%# DataBinder.Eval(Container.DataItem, "FirstName") %>' runat="server" /><br />
					</ItemTemplate><br />
				</asp:TemplateColumn><br />
				<asp:TemplateColumn HeaderText="Age"><br />
					<HeaderStyle Width="15%" CssClass="Grid_HeaderStyle"></HeaderStyle><br />
					<ItemStyle CssClass="Grid_ItemStyle"></ItemStyle><br />
					<ItemTemplate><br />
						<asp:Label id="lblAge" Text='<%# DataBinder.Eval(Container.DataItem, "Age") %>' runat="server" /><br />
					</ItemTemplate><br />
				</asp:TemplateColumn><br />
			</Columns><br />
			<PagerStyle Visible="False"></PagerStyle><br />
		</asp:datagrid><br />
<br />


ASPX.VB class:
All labels and datagrid declared

<br />
<br />
    Dim dgMembers As DataGrid<br />
    Dim lblFirstName As Label<br />
    Dim lblAge As Label<br />
<br />
    Public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
<br />
        ' Put user code here to initialize the data source <br />
        ' filling the dataset<br />
        Dim dsMembers As DataSet = New DataSet<br />
        dsMembers = Member.GetAllMembers()<br />
<br />
        'Response.Write(Member.GetAllMembers().ToString)<br />
        dgMembers.DataSource = dsMembers<br />
        dgMembers.DataBind()<br />
<br />
<br />
    End Sub<br />


Member.vb:


<br />
        Public Shared Function GetAllMembers() As DataSet<br />
            Return MemberDA.GetAllMembers()<br />
        End Function<br />



MemberDA.vb:

<br />
<br />
 Public Shared Function GetAllMembers() As DataSet<br />
<br />
            Dim dsMemberResults As New DataSet<br />
<br />
            ' Create instance of SqlConnection and SqlDataAdapter object<br />
            Dim objConn As SqlConnection = New SqlConnection(Globals.GetConnectionString)<br />
            Dim objCmd As SqlDataAdapter = New SqlDataAdapter("SELECT * FROM Members", objConn)<br />
<br />
            Try<br />
<br />
                'Open the connection to the database<br />
                objConn.Open()<br />
<br />
                ' Create and fill a DataSet.<br />
                objCmd.Fill(dsMemberResults)<br />
<br />
            Catch ex As Exception<br />
                Dim strExceptionMsg As String = "Error Executing GetAllMembers(): " + ex.Message + "\r\n"<br />
                Throw New Exception(strExceptionMsg, ex)<br />
            Finally<br />
                'close the connection once retrieving the information is done<br />
                objConn.Close()<br />
            End Try<br />
<br />
            Return dsMemberResults<br />
<br />
        End Function<br />
<br />


Playout
AnswerRe: Error binding dataset Pin
minhpc_bk11-May-06 15:55
minhpc_bk11-May-06 15:55 
QuestionconnectionString in machine.config Pin
Anthony Ford11-May-06 7:57
Anthony Ford11-May-06 7:57 
AnswerRe: connectionString in machine.config Pin
minhpc_bk11-May-06 19:43
minhpc_bk11-May-06 19:43 
GeneralRe: connectionString in machine.config Pin
Anthony Ford12-May-06 2:02
Anthony Ford12-May-06 2:02 
GeneralRe: connectionString in machine.config Pin
minhpc_bk12-May-06 6:27
minhpc_bk12-May-06 6:27 
GeneralRe: connectionString in machine.config Pin
Anthony Ford12-May-06 6:56
Anthony Ford12-May-06 6:56 
Questionconverting Pin
ptvce11-May-06 6:15
ptvce11-May-06 6:15 
AnswerRe: converting Pin
minhpc_bk11-May-06 19:44
minhpc_bk11-May-06 19:44 
QuestionProblem related to dropdown list. Pin
123xyztt11-May-06 5:00
123xyztt11-May-06 5:00 
AnswerRe: Problem related to dropdown list. Pin
minhpc_bk11-May-06 19:52
minhpc_bk11-May-06 19:52 
QuestionImage not showing on Hosting site Pin
Ista11-May-06 4:12
Ista11-May-06 4:12 
AnswerRe: Image not showing on Hosting site Pin
KrIstOfK11-May-06 4:22
KrIstOfK11-May-06 4:22 
GeneralRe: Image not showing on Hosting site Pin
Ista11-May-06 4:54
Ista11-May-06 4:54 
QuestionDataList not showing Pin
kbalias11-May-06 2:25
kbalias11-May-06 2:25 
AnswerRe: DataList not showing Pin
minhpc_bk11-May-06 19:55
minhpc_bk11-May-06 19:55 
GeneralRe: DataList not showing Pin
kbalias14-May-06 19:34
kbalias14-May-06 19:34 
QuestionError for opration = Pin
ptvce11-May-06 1:52
ptvce11-May-06 1:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.