Solved - errors with code in the dataset.....

Posted on 2011-10-17
Last Modified: 2012-05-12
get an error here:

type dataset is not defined...
Imports System.Configuration
Imports System.Text
Imports System.IO
Imports System.Drawing.Imaging
Imports System.Drawing.Drawing2D
Imports AjaxControlToolkit

Partial Class Handler_AutoSuggestDirectAccounts
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            Dim q As String = Request("q")
            Dim SQLQuery As String
            '            select Name,CITY, CASE DEANumber WHEN IS NULL THEN  '' END,ProfileCode from Profiles
            'WHERE Type <> 'Manufacturer'
            'ORDER BY Name ASC
            SQLQuery = "SELECT Name, case ndc when 0 then cast(UPC as varchar) else cast(NDC as varchar) end + ' [' + Description + ']' AS DESCRIPTION FROM Products WHERE CAST(NDC AS VARCHAR) like '" & q & "%' OR CAST(UPC AS VARCHAR) like '" & q & "%' ORDER BY DESCRIPTION;"
            ' SQLQuery = "SELECT Name, city,deanumber, ProfileCode from Profiles WHERE CAST(name AS VARCHAR) like '" & q & "%'  ORDER BY name;"

            Dim ds As DataSet = abcComp.DataAccess.Database.ExecuteDataset(CommandType.Text, SQLQuery)

            For Each dr As DataRow In ds.Tables(0).Rows
                Response.Write(dr.Item("ID").ToString() + "|" + dr.Item("DESCRIPTION").ToString() + "|" + Environment.NewLine)
                '    Response.Write(dr.Item("NAME").ToString() + "|" + dr.Item("DEANUMBER").ToString() + "|" + Environment.NewLine)
        End If
    End Sub
End Class

Open in new window

Question by:GlobaLevel
    LVL 6

    Accepted Solution

    An import is missing - System.Data.DataSet

    If that does not solve the problem, please let us know the version of .NET framework you are using.
    LVL 6

    Expert Comment

    I would like to correct a tupo in my answrr above, the missing line is:
    Imports System.Data
    LVL 9

    Expert Comment

    at top of the page


    and for data set :

    Using conn As New OleDbConnection(ConnString)
      Using cmd As New OleDbCommand(SqlString, conn)
        cmd.CommandType = CommandType.Text
      End Using
    End Using

    Dim ds As DataSet = cmd.ExecuteNonQuery()
    LVL 3

    Expert Comment

    First you can import the namespace System.Data so it allow to use the dataset object using
    Imports System.Data in
    using System.Data; in C#

    also you can declare the dataset
    Dim ds as new Dataset = cmd.ExecuteNonQuery();

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
    A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
    This video discusses moving either the default database or any database to a new volume.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now