[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 306
  • Last Modified:

asp.net - errors with code in the dataset.....

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
            Response.Clear()
            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)
            Next
            Response.Flush()
            Response.End()
        End If
    End Sub
End Class

Open in new window

0
GlobaLevel
Asked:
GlobaLevel
  • 2
1 Solution
 
regevhaCommented:
An import is missing - System.Data.DataSet http://msdn.microsoft.com/en-us/library/system.data.dataset(v=vs.71).aspx 

If that does not solve the problem, please let us know the version of .NET framework you are using.
0
 
regevhaCommented:
I would like to correct a tupo in my answrr above, the missing line is:
Imports System.Data
0
 
keyuCommented:
at top of the page

Imports System.data

and for data set :

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


Dim ds As DataSet = cmd.ExecuteNonQuery()
0
 
ExpertLogin_890Commented:
Hello,
First you can import the namespace System.Data so it allow to use the dataset object using
Imports System.Data in vb.net
using System.Data; in C#

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

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now