Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > BOOK: Beginning ASP.NET 1.1
|
BOOK: Beginning ASP.NET 1.1
This is the forum to discuss the Wrox book Beginning ASP.NET 1.1 with Visual C#.NET 2003 by Chris Ullman, John Kauffman, Chris Hart, Dave Sussman, Daniel Maharry; ISBN: 9780764557088
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 25th, 2004, 10:02 PM
Authorized User
 
Join Date: Apr 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Value cannot be null. Parameter name: dataSet

Can anyone tell me why im getting this error??

Heres the code Im using

%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="DataControlCH2.WebForm1" debug="True"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.Oledb" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
    <HEAD>
        <title>Data Grid Control Example</title>
        <script runat="server">
'Sub Page_Load(Sender as Object, E as EventArgs)
    Dim myCNN as OleDbConnection
    Dim objCommand as OleDbDataAdapter
    Dim mySQL as string
    Dim strConnect as string
    Dim DataSet1 as DataSet
    strConnect= "Provider=Microsoft.Jet.OLEDB.4.0;"
    strConnect+="Data Source=C:\AccessWork\CompanyDatabase.mdb;"
    strConnect+="Persist Security Info=False"
    mySQL= "Select SSN,FName,LName From Employee"
    myCNN= New OleDBConnection(strConnect)
    objCommand=New OleDBDataAdapter(mySQL,myCNN)
    objCommand.Fill(DataSet1, "employee")
    DataGrid1.DataSource=DataSet1.Tables("Employee").D efaultView
    DataGrid1.DataBind()
End Sub
</script>
        <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
        <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
        <meta name="vs_defaultClientScript" content="VBScript">
        <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    </HEAD>
    <body MS_POSITIONING="GridLayout" BGCOLOR="#ffffff">
        <form id="WebForm1" method="post" runat="server">
            &nbsp;
            <asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 136px; POSITION: absolute; TOP: 136px"
                runat="server" Width="216px" Height="168px"></asp:DataGrid>
        </form>
    </body>
</HTML>


 
Old May 26th, 2004, 07:38 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hello,

I don't see where you instantiate the dataset. Change:

Dim DataSet1 as DataSet

To:

Dim DataSet1 as New DataSet

or instantiate it later when needed.

Brian
 
Old May 26th, 2004, 09:13 AM
Authorized User
 
Join Date: Apr 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks alot! That worked. I forgot to create the "New" dataset.
Thanks for the help!

 
Old June 16th, 2006, 03:38 AM
Registered User
 
Join Date: Jun 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i met this error too not long ago
just DataSet dstDS = new DataSet();
then ok!






Similar Threads
Thread Thread Starter Forum Replies Last Post
passing a null value thru sql parameter polofson .NET Framework 2.0 1 May 3rd, 2006 12:56 AM
How do you set a column to NULL in a parameter? Aaron Edwards ASP.NET 2.0 Basics 1 April 7th, 2006 11:26 PM
How do you set a column to NULL in a parameter? Aaron Edwards ADO.NET 3 April 7th, 2006 06:26 PM
Dataset Update with Null Value [V] reyboy ADO.NET 2 June 1st, 2004 12:18 PM
null value for parameter schockp VB Databases Basics 2 October 31st, 2003 08:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.